Class: Bixby::Model::Base
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(hash = nil) ⇒ Base
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# File 'lib/bixby-client/model/base.rb', line 111
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
23
24
25
|
# File 'lib/bixby-client/model/base.rb', line 23
def destroy(id)
raise NotImplementedError
end
|
15
16
17
|
# File 'lib/bixby-client/model/base.rb', line 15
def find(id)
raise NotImplementedError
end
|
.list(*args) ⇒ Object
11
12
13
|
# File 'lib/bixby-client/model/base.rb', line 11
def list(*args)
raise NotImplementedError
end
|
.update(id, data) ⇒ Object
19
20
21
|
# File 'lib/bixby-client/model/base.rb', line 19
def update(id, data)
raise NotImplementedError
end
|
Instance Method Details
126
127
128
129
130
131
|
# File 'lib/bixby-client/model/base.rb', line 126
def [](key)
if self.respond_to?(key.to_sym) then
return self.send(key.to_sym)
end
return nil
end
|