Class: LensProtocol::OMA::Type::Integer

Inherits:
Base
  • Object
show all
Defined in:
lib/lens_protocol/oma/type/integer.rb

Instance Method Summary collapse

Methods inherited from Base

#format, #initialize, #parse

Constructor Details

This class inherits a constructor from LensProtocol::OMA::Type::Base

Instance Method Details

#format_value(value) ⇒ Object



9
10
11
# File 'lib/lens_protocol/oma/type/integer.rb', line 9

def format_value value
  value.round if value
end

#parse_value(value) ⇒ Object



5
6
7
# File 'lib/lens_protocol/oma/type/integer.rb', line 5

def parse_value value
  Integer(value) rescue Float(value).round rescue nil
end