Class: Bixby::Model::Base
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(hash = nil) ⇒ Base
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
|
Class Method Details
.destroy(id) ⇒ Object
25
26
27
|
# File 'lib/bixby-client/model/base.rb', line 25
def destroy(id)
raise NotImplementedError
end
|
17
18
19
|
# File 'lib/bixby-client/model/base.rb', line 17
def find(id)
raise NotImplementedError
end
|
.list(*args) ⇒ Object
13
14
15
|
# File 'lib/bixby-client/model/base.rb', line 13
def list(*args)
raise NotImplementedError
end
|
.update(id, data) ⇒ Object
21
22
23
|
# File 'lib/bixby-client/model/base.rb', line 21
def update(id, data)
raise NotImplementedError
end
|
Instance Method Details
128
129
130
131
132
133
|
# File 'lib/bixby-client/model/base.rb', line 128
def [](key)
if self.respond_to?(key.to_sym) then
return self.send(key.to_sym)
end
return nil
end
|