Class: FeedMe::SimpleStruct

Inherits:
Object show all
Defined in:
lib/feed_me/simple_struct.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}) ⇒ SimpleStruct

Returns a new instance of SimpleStruct.



5
6
7
8
9
10
11
# File 'lib/feed_me/simple_struct.rb', line 5

def initialize(hash = {})
  (class << self; self; end).module_eval do
    hash.each do |method, result|
      define_method( method ) { result }
    end
  end
end