Class: Hamachi::ListField
- Inherits:
-
Field
- Object
- Field
- Hamachi::ListField
show all
- Defined in:
- lib/hamachi/source/field.rb
Instance Method Summary
collapse
Methods inherited from Field
#initialize
Constructor Details
This class inherits a constructor from Hamachi::Field
Instance Method Details
#===(value) ⇒ Object
60
61
62
63
64
|
# File 'lib/hamachi/source/field.rb', line 60
def ===(value)
return false unless Array === value
return false if value.empty? unless @option_empty
value.all? { |each| @type === each }
end
|
#default_value ⇒ Object
66
67
68
|
# File 'lib/hamachi/source/field.rb', line 66
def default_value
[]
end
|
#from_snapshot(data, options) ⇒ Object
74
75
76
|
# File 'lib/hamachi/source/field.rb', line 74
def from_snapshot(data, options)
data && data.map { |each| super(each, options) }
end
|
#initialize_options(options) ⇒ Object
56
57
58
|
# File 'lib/hamachi/source/field.rb', line 56
def initialize_options(options)
@option_empty = options.fetch(:empty, true)
end
|
#to_s ⇒ Object
70
71
72
|
# File 'lib/hamachi/source/field.rb', line 70
def to_s
"list(#{@type}#{', empty: false' unless @option_empty})"
end
|