Skip to content

Commit

Permalink
RBS + broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Jun 30, 2024
1 parent e5363ed commit bc0da50
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 65 deletions.
2 changes: 0 additions & 2 deletions .rspec

This file was deleted.

1 change: 0 additions & 1 deletion hearth/.rspec

This file was deleted.

1 change: 1 addition & 0 deletions hearth/lib/hearth.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
module Hearth
VERSION = File.read(File.expand_path('../VERSION', __dir__)).strip

# @api private
@config = {}

class << self
Expand Down
53 changes: 0 additions & 53 deletions hearth/lib/hearth/config/resolver.rb
Original file line number Diff line number Diff line change
@@ -1,58 +1,5 @@
# frozen_string_literal: true

# module Hearth
# # @api private
# module Config
# # Resolves configuration defaults.
# class Resolver
# private_class_method :new
#
# # @param config [Struct]
# # @param defaults [Hash<Symbol, Array>]
# # @return [Struct]
# def self.resolve(config, defaults = {})
# new(config).send(:resolve, defaults)
# end
#
# def [](key)
# unless @resolved[key]
# @config[key] = resolve_default(key)
# @resolved[key] = true
# end
# @config[key]
# end
#
# private
#
# # @param config [Struct]
# def initialize(config)
# @config = config
# @resolved = {}
# end
#
# def resolve(defaults)
# @defaults = defaults
# @config.members.each do |key|
# @config[key] = self[key]
# end
# end
#
# def resolve_default(key)
# @defaults[key]&.each do |default|
# value =
# if default.respond_to?(:call)
# default.call(self)
# else
# default
# end
# return value unless value.nil?
# end
# nil
# end
# end
# end
# end

module Hearth
# @api private
module Config
Expand Down
2 changes: 1 addition & 1 deletion hearth/lib/hearth/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize(**options)
end

# @return [Hash<Symbol, Object>] The original configuration options.
attr_accessor :options
attr_reader :options

def merge(configuration)
self.class.new(**to_h.merge(configuration.to_h))
Expand Down
7 changes: 7 additions & 0 deletions hearth/sig/lib/hearth.rbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module Hearth
VERSION: String

attr_reader self.config: Hash[Symbol, untyped]

def self.config=: (Hash[Symbol, untyped] config) -> Hash[Symbol, untyped]
end
2 changes: 2 additions & 0 deletions hearth/sig/lib/hearth/configuration.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module Hearth
module Configuration[ServiceConfig]
def initialize: (**Hash[Symbol, untyped] options) -> void

attr_reader options: Hash[Symbol, untyped]

def merge: (Hash[Symbol, untyped] configuration) -> ServiceConfig
end
end
16 changes: 8 additions & 8 deletions hearth/spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# frozen_string_literal: true

require 'simplecov'
SimpleCov.minimum_coverage 100
SimpleCov.start do
add_filter %r{/spec/}
end

require 'hearth'

# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand All @@ -16,14 +24,6 @@
#
# See https://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration

require 'simplecov'
SimpleCov.minimum_coverage 100
SimpleCov.start do
add_filter %r{/spec/}
end

require 'hearth'

RSpec.configure do |config|
# rspec-expectations config goes here. You can use an alternate
# assertion/expectation library such as wrong or the stdlib/minitest
Expand Down

0 comments on commit bc0da50

Please sign in to comment.