Method: Bixby::Model::Base#initialize

Defined in:
lib/bixby-client/model/base.rb

#initialize(hash = nil) ⇒ Base

self



113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/bixby-client/model/base.rb', line 113

def initialize(hash=nil)
  return if hash.nil?

  hash.each do |k,v|
    instance_variable_set("@#{k}", v)
    next if self.respond_to?(k.to_sym)
    code = <<-EOF
    def #{k}()
      @#{k}
    end
    EOF
    eval(code)
  end
end