Module: HaystackRuby::Types::Time

Defined in:
lib/haystack_ruby/types/time.rb

Overview

Since there is no Ruby Hour class, value is a string “hr:minute”

Instance Method Summary collapse

Instance Method Details

#set_fields(str_value) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/haystack_ruby/types/time.rb', line 5

def set_fields str_value
  @haystack_type = 'Time'
  match = /\Ah:([0-9:]*)\z/.match str_value
  begin
    @value = match[1]
  rescue Exception=>e
    raise HaystackRuby::Error, "invalid HaystackRuby::Types::Time #{str_value}.  Error #{e}"
  end
end