Class: Hamachi::Model::ListMatcher
Instance Method Summary
collapse
Methods inherited from Matcher
#initialize
Instance Method Details
#===(value) ⇒ Object
231
232
233
234
235
|
# File 'lib/hamachi/model.rb', line 231
def ===(value)
return false unless Array === value
return false if value.empty? unless @option_empty
value.all? { |each| @type === each }
end
|
#default_value ⇒ Object
237
238
239
|
# File 'lib/hamachi/model.rb', line 237
def default_value
[]
end
|
#from_snapshot(data, options) ⇒ Object
245
246
247
|
# File 'lib/hamachi/model.rb', line 245
def from_snapshot(data, options)
data && data.map { |each| super(each, options) }
end
|
#initialize_options(options) ⇒ Object
227
228
229
|
# File 'lib/hamachi/model.rb', line 227
def initialize_options(options)
@option_empty = options.fetch(:empty, true)
end
|
#to_s ⇒ Object
241
242
243
|
# File 'lib/hamachi/model.rb', line 241
def to_s
"list(#{@type}#{', empty: false' unless @option_empty})"
end
|