Class: Arrest::Converter

Inherits:
Object
  • Object
show all
Defined in:
lib/arrest/attributes/converter.rb

Direct Known Subclasses

IdentConv, TimeConv

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clazzObject (readonly)

Returns the value of attribute clazz.



36
37
38
# File 'lib/arrest/attributes/converter.rb', line 36

def clazz
  @clazz
end

Class Method Details

.convert(value) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/arrest/attributes/converter.rb', line 38

def convert value
  if value.is_a?(self.clazz)
    value
  else
    self.parse value
  end
end

.mk_json(obj) ⇒ Object



46
47
48
# File 'lib/arrest/attributes/converter.rb', line 46

def mk_json obj
  obj
end

.target(clazz) ⇒ Object



50
51
52
53
# File 'lib/arrest/attributes/converter.rb', line 50

def target clazz
  @clazz = clazz
  CONVERTER[clazz] = self
end