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.



15
16
17
# File 'lib/arrest/attributes/converter.rb', line 15

def clazz
  @clazz
end

Class Method Details

.convert(value) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/arrest/attributes/converter.rb', line 17

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

.mk_json(obj) ⇒ Object



25
26
27
# File 'lib/arrest/attributes/converter.rb', line 25

def mk_json obj
  obj
end

.target(clazz) ⇒ Object



29
30
31
32
# File 'lib/arrest/attributes/converter.rb', line 29

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