class HaystackRuby::Object
Attributes
description[R]
May be present, depending on type
haystack_type[R]
Always present
unit[R]
May be present, depending on type
value[R]
Always present
Public Class Methods
new(val)
click to toggle source
initialize with a encoded json string
# File lib/haystack_ruby/object.rb, line 20 def initialize val case val when Array @haystack_type = "Array" #may want to decode array components? @value = val when TrueClass @haystack_type = "Boolean" @value = val when FalseClass @haystack_type = "Boolean" @value = val when NilClass @haystack_type = 'Null' @value = val when String # Map to Haystack type per http://project-haystack.org/doc/Json case val when /\Am:.*/ extend HaystackRuby::Types::Marker when /\Az:.*/ extend HaystackRuby::Types::NA when /\An:.*/ extend HaystackRuby::Types::Number when /\Ar:.*/ extend HaystackRuby::Types::Ref when /\As:.*/ extend HaystackRuby::Types::Str when /\Ad:.*/ extend HaystackRuby::Types::Date when /\Ah:.*/ extend HaystackRuby::Types::Time when /\At:.*/ extend HaystackRuby::Types::DateTime when /\Au:.*/ extend HaystackRuby::Types::Uri when /\Ab:.*/ extend HaystackRuby::Types::Bin when /\Ac:.*/ extend HaystackRuby::Types::Coord when /\Ax:.*/ raise HaystackRuby::Error, "parsing of XStr type is not supported for string val #{val}" else raise HaystackRuby::Error, "unrecognized type for string val #{val}" end else raise HaystackRuby::Error, "unrecognized type for val #{val}" end set_fields val end