Class: E621::Pool
Instance Method Summary
collapse
Methods inherited from Container
#method_missing
Constructor Details
#initialize(post) ⇒ Pool
Returns a new instance of Pool.
24
25
26
|
# File 'lib/pool.rb', line 24
def initialize(post)
set_variables(post)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class E621::Container
Instance Method Details
#keys ⇒ Object
28
29
30
|
# File 'lib/pool.rb', line 28
def keys
return instance_variables.map{|i|i.to_s.sub("@","")}
end
|
#name=(name) ⇒ Object
36
37
38
|
# File 'lib/pool.rb', line 36
def name=(name)
@name = name
end
|
#posts=(posts) ⇒ Object
40
41
42
|
# File 'lib/pool.rb', line 40
def posts=(posts)
@posts = posts
end
|
#to_json(n = nil) ⇒ Object
44
45
46
47
48
49
50
51
52
|
# File 'lib/pool.rb', line 44
def to_json(n=nil)
json_hash = Hash.new
instance_variables.each do |i|
v = instance_variable_get(i)
v = v.is_a?(Time) ? v.to_i : v
json_hash.store(i.to_s.sub("@",""),v)
end
return json_hash.to_json
end
|
#updated_at=(time) ⇒ Object
32
33
34
|
# File 'lib/pool.rb', line 32
def updated_at=(time)
@updated_at = time
end
|