Class: Hamachi::Model::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/hamachi/model.rb

Overview

— Matcher classes —————————————

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Matcher

Returns a new instance of Matcher.



182
183
184
# File 'lib/hamachi/model.rb', line 182

def initialize(type)
  @type = type
end

Instance Method Details

#===(value) ⇒ Object



189
190
191
# File 'lib/hamachi/model.rb', line 189

def ===(value)
  @type === value
end

#default_valueObject



193
194
195
# File 'lib/hamachi/model.rb', line 193

def default_value
  nil
end

#from_snapshot(data, options) ⇒ Object



201
202
203
204
205
206
207
208
209
# File 'lib/hamachi/model.rb', line 201

def from_snapshot(data, options)
  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



186
187
# File 'lib/hamachi/model.rb', line 186

def initialize_options(options)
end

#to_sObject



197
198
199
# File 'lib/hamachi/model.rb', line 197

def to_s
  @type.to_s
end