class Praxis::ConfigHash
Attributes
Public Class Methods
Source
# File lib/praxis/config_hash.rb, line 8 def self.from(hash = {}, &block) new(hash, &block) end
Source
# File lib/praxis/config_hash.rb, line 12 def initialize(hash = {}, &block) @hash = hash @block = block end
Public Instance Methods
Source
# File lib/praxis/config_hash.rb, line 26 def method_missing(name, value, *rest, &block) if (existing = @hash[name]) if block existing << [value, block] else existing << value rest.each do |v| existing << v end end else @hash[name] = if rest.any? [value] + rest else value end end end
Source
# File lib/praxis/config_hash.rb, line 22 def respond_to_missing?(_method_name, _include_private = false) true end
Source
# File lib/praxis/config_hash.rb, line 17 def to_hash instance_eval(&@block) @hash end