Class: Cronofy::EventTime

Inherits:
Object
  • Object
show all
Defined in:
lib/cronofy/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(time, tzid) ⇒ EventTime

Returns a new instance of EventTime.



257
258
259
260
# File 'lib/cronofy/types.rb', line 257

def initialize(time, tzid)
  @time = time
  @tzid = tzid
end

Instance Attribute Details

#timeObject (readonly)

Returns the value of attribute time.



254
255
256
# File 'lib/cronofy/types.rb', line 254

def time
  @time
end

#tzidObject (readonly)

Returns the value of attribute tzid.



255
256
257
# File 'lib/cronofy/types.rb', line 255

def tzid
  @tzid
end

Class Method Details

.coerce(value) ⇒ Object



262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/cronofy/types.rb', line 262

def self.coerce(value)
  case value
  when String
    DateOrTime.coerce(value)
  when Hash
    time_value = value["time"]
    tzid = value["tzid"]

    date_or_time = DateOrTime.coerce(time_value)

    new(date_or_time, tzid)
  end
end

Instance Method Details

#==(other) ⇒ Object



276
277
278
279
280
281
282
283
# File 'lib/cronofy/types.rb', line 276

def ==(other)
  case other
  when EventTime
    self.time == other.time && self.tzid == other.tzid
  else
    false
  end
end