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
nil?
)
- VERSION =
"0.6.1"
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(table) ⇒ Fetching
Returns a new instance of Fetching.
37
38
39
|
# File 'lib/fetching.rb', line 37
def initialize table
@table = table
end
|
Class Method Details
.from(value) ⇒ Object
26
27
28
29
30
31
|
# File 'lib/fetching.rb', line 26
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
33
34
35
|
# File 'lib/fetching.rb', line 33
def self.from_json json
from(JSON.parse json)
end
|
Instance Method Details
#==(other) ⇒ Object
41
42
43
|
# File 'lib/fetching.rb', line 41
def ==(other)
other.hash == hash
end
|
#hash ⇒ Object
45
46
47
|
# File 'lib/fetching.rb', line 45
def hash
self.class.hash ^ @table.hash
end
|
#inspect ⇒ Object
57
58
59
|
# File 'lib/fetching.rb', line 57
def inspect
"#<#{self.class.name}: @table=#{@table}>"
end
|
#to_fetching ⇒ Object
49
50
51
|
# File 'lib/fetching.rb', line 49
def to_fetching
self
end
|
#to_s ⇒ Object
53
54
55
|
# File 'lib/fetching.rb', line 53
def to_s
@table.to_s
end
|