Class: Fetching
- Inherits:
-
Object
show all
- Defined in:
- lib/fetching.rb,
lib/fetching/version.rb,
lib/fetching/fetching_hash.rb,
lib/fetching/fetching_array.rb
Defined Under Namespace
Classes: FetchingArray, FetchingHash
Constant Summary
collapse
- WHITELIST =
%w(
class object_id == equal?
define_singleton_method instance_eval
respond_to?
instance_variables instance_variable_get
)
- VERSION =
"0.6.0"
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(table) ⇒ Fetching
Returns a new instance of Fetching.
36
37
38
|
# File 'lib/fetching.rb', line 36
def initialize table
@table = table
end
|
Class Method Details
.from(value) ⇒ Object
25
26
27
28
29
30
|
# File 'lib/fetching.rb', line 25
def self.from(value)
return value.to_fetching if value.respond_to? :to_fetching
return FetchingArray.new(value.to_ary) if value.respond_to? :to_ary
return FetchingHash.new(value.to_hash) if value.respond_to? :to_hash
value
end
|
.from_json(json) ⇒ Object
32
33
34
|
# File 'lib/fetching.rb', line 32
def self.from_json json
from(JSON.parse json)
end
|
Instance Method Details
#==(other) ⇒ Object
40
41
42
|
# File 'lib/fetching.rb', line 40
def ==(other)
other.hash == hash
end
|
#hash ⇒ Object
44
45
46
|
# File 'lib/fetching.rb', line 44
def hash
self.class.hash ^ @table.hash
end
|
#inspect ⇒ Object
56
57
58
|
# File 'lib/fetching.rb', line 56
def inspect
"#<#{self.class.name}: @table=#{@table}>"
end
|
#to_fetching ⇒ Object
48
49
50
|
# File 'lib/fetching.rb', line 48
def to_fetching
self
end
|
#to_s ⇒ Object
52
53
54
|
# File 'lib/fetching.rb', line 52
def to_s
@table.to_s
end
|