Class: MR::Factory::ReadModelFactory::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/mr/factory/read_model_factory.rb

Instance Method Summary collapse

Constructor Details

#initializeData

Returns a new instance of Data.



87
# File 'lib/mr/factory/read_model_factory.rb', line 87

def initialize; @hash = {}; end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



92
93
94
95
96
97
98
99
# File 'lib/mr/factory/read_model_factory.rb', line 92

def method_missing(method, *args, &block)
  method_string = method.to_s
  if method_string =~ /=\z/ && args.size == 1
    @hash[method_string.gsub('=', '')] = args.first
  else
    super
  end
end

Instance Method Details

#[](key) ⇒ Object



89
# File 'lib/mr/factory/read_model_factory.rb', line 89

def [](key);         @hash[key];         end

#[]=(key, value) ⇒ Object



90
# File 'lib/mr/factory/read_model_factory.rb', line 90

def []=(key, value); @hash[key] = value; end