Class: Fbtxt::Model::Minute

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/fbtxt/document/models/minute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(m:, offset: nil, secs: nil) ⇒ Minute

Returns a new instance of Minute.



9
10
11
12
13
# File 'lib/fbtxt/document/models/minute.rb', line 9

def initialize( m:, offset: nil, secs: nil )
  @m      = m
  @offset = offset
  @secs   = secs
end

Instance Attribute Details

#mObject (readonly)

Returns the value of attribute m.



7
8
9
# File 'lib/fbtxt/document/models/minute.rb', line 7

def m
  @m
end

#offsetObject (readonly)

Returns the value of attribute offset.



7
8
9
# File 'lib/fbtxt/document/models/minute.rb', line 7

def offset
  @offset
end

#secsObject (readonly)

Returns the value of attribute secs.



7
8
9
# File 'lib/fbtxt/document/models/minute.rb', line 7

def secs
  @secs
end

Instance Method Details

#<=>(other) ⇒ Object



45
46
47
48
49
50
51
52
# File 'lib/fbtxt/document/models/minute.rb', line 45

def <=>(other)
   return nil unless other.is_a?(Minute)

  ## returns -1/0/1
   res =   m <=> other.m
   res =  (offset||0) <=> (other.offset||0)   if res == 0
   res
end

#as_jsonObject



26
# File 'lib/fbtxt/document/models/minute.rb', line 26

def as_json(*) to_s; end

#pretty_print(q) ⇒ Object



39
40
41
# File 'lib/fbtxt/document/models/minute.rb', line 39

def pretty_print( q )
   q.text( to_s )
end

#to_sObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/fbtxt/document/models/minute.rb', line 28

def to_s
  buf = String.new
  buf << "#{m}"
  ### note - do NOT autoadd minute quote for now
  ##    make it an option e.g.  to_s( :quote) or such - why? why not?
  ### buf << "'"
  buf << "+#{offset}"      if offset
  buf << "/#{secs} secs"   if secs
  buf
end