Class: Manabu::Resource
- Inherits:
-
Object
show all
- Defined in:
- lib/manabu/resource.rb
Instance Method Summary
collapse
Constructor Details
#initialize(client, **info) ⇒ Resource
Returns a new instance of Resource.
3
4
5
6
|
# File 'lib/manabu/resource.rb', line 3
def initialize(client, **info)
@client = client
fill(info)
end
|
Instance Method Details
#_fill(var, sym, hash) ⇒ Object
11
12
13
|
# File 'lib/manabu/resource.rb', line 11
def _fill(var, sym, hash)
var = hash[sym] if (hash.include?(sym) && !hash[sym].nil?)
end
|
#fill(**info) ⇒ Object
8
9
|
# File 'lib/manabu/resource.rb', line 8
def fill(**info)
end
|
#to_hash ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/manabu/resource.rb', line 15
def to_hash
hash = {}
instance_variables.each do |var|
iv = instance_variable_get(var)
hash[(var.to_s.delete("@")).to_sym] = iv if !iv.nil?
end
hash
end
|