Class: Fbtxt::Model::EventSub

Inherits:
Object
  • Object
show all
Defined in:
lib/fbtxt/document/models/event.rb

Overview

use just Sub or ??

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(on:, off:, minute: nil) ⇒ EventSub

Returns a new instance of EventSub.



47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/fbtxt/document/models/event.rb', line 47

def initialize( on:, off:, minute: nil )
    @name_on  = on
    @name_off = off

    ## note - auto-convert to our own Minute format
    @minute =  if minute.is_a?( RaccMatchParser::Minute )
                    Minute.new( m:      minute.m,
                                offset: minute.offset,
                                secs:   minute.secs )
               else
                minute
               end
end

Instance Attribute Details

#minuteObject (readonly)

Returns the value of attribute minute.



45
46
47
# File 'lib/fbtxt/document/models/event.rb', line 45

def minute
  @minute
end

#name_offObject (readonly)

use off only



44
45
46
# File 'lib/fbtxt/document/models/event.rb', line 44

def name_off
  @name_off
end

#name_onObject (readonly)

use on only - why? why not?



43
44
45
# File 'lib/fbtxt/document/models/event.rb', line 43

def name_on
  @name_on
end

Instance Method Details

#as_jsonObject



61
62
63
64
65
66
67
# File 'lib/fbtxt/document/models/event.rb', line 61

def as_json(*)
    h = { 'on'  => name_on,
          'off' => name_off }
    h['minute'] = minute.to_s    if minute

    h
end