Class: Hamachi::Field
- Inherits:
-
Object
show all
- Defined in:
- lib/hamachi/source/field.rb
Instance Method Summary
collapse
Constructor Details
#initialize(type) ⇒ Field
7
8
9
|
# File 'lib/hamachi/source/field.rb', line 7
def initialize(type)
@type = type
end
|
Instance Method Details
#===(value) ⇒ Object
14
15
16
|
# File 'lib/hamachi/source/field.rb', line 14
def ===(value)
@type === value
end
|
#default_value ⇒ Object
18
19
20
|
# File 'lib/hamachi/source/field.rb', line 18
def default_value
nil
end
|
#from_snapshot(data, options = nil) ⇒ Object
26
27
28
29
30
31
32
33
34
|
# File 'lib/hamachi/source/field.rb', line 26
def from_snapshot(data, options = nil)
if @type == Symbol
data.to_sym if data
elsif Class === @type && @type.respond_to?(:from_snapshot)
@type.from_snapshot(data, options)
else
data
end
end
|
#initialize_options(options) ⇒ Object
11
12
|
# File 'lib/hamachi/source/field.rb', line 11
def initialize_options(options)
end
|
#to_s ⇒ Object
22
23
24
|
# File 'lib/hamachi/source/field.rb', line 22
def to_s
@type.to_s
end
|