class FrOData::Properties::Binary
Public Instance Methods
type()
click to toggle source
The FrOData
type name
# File lib/frodata/properties/binary.rb, line 23 def type 'Edm.Binary' end
url_value()
click to toggle source
Value to be used in URLs. @return [String]
# File lib/frodata/properties/binary.rb, line 29 def url_value "binary'#{value}'" end
value()
click to toggle source
Returns the property value, properly typecast @return [Integer,nil]
# File lib/frodata/properties/binary.rb, line 7 def value if (@value.nil? || @value.empty?) && allows_nil? nil else @value.to_i end end
value=(new_value)
click to toggle source
Sets the property value @params new_value [0,1,Boolean]
# File lib/frodata/properties/binary.rb, line 17 def value=(new_value) validate(new_value) @value = parse_value(new_value) end
Private Instance Methods
parse_value(value)
click to toggle source
# File lib/frodata/properties/binary.rb, line 35 def parse_value(value) if value == 0 || value == '0' || value == false '0' else '1' end end
validate(value)
click to toggle source
# File lib/frodata/properties/binary.rb, line 43 def validate(value) unless [0,1,'0','1',true,false].include?(value) validation_error 'Value is outside accepted range: 0 or 1' end end