Class: Fbtxt::Model::Minute
- Inherits:
-
Object
- Object
- Fbtxt::Model::Minute
- Includes:
- Comparable
- Defined in:
- lib/fbtxt/document/models/minute.rb
Instance Attribute Summary collapse
-
#m ⇒ Object
readonly
Returns the value of attribute m.
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#secs ⇒ Object
readonly
Returns the value of attribute secs.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #as_json ⇒ Object
-
#initialize(m:, offset: nil, secs: nil) ⇒ Minute
constructor
A new instance of Minute.
- #pretty_print(q) ⇒ Object
- #to_s ⇒ Object
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
#m ⇒ Object (readonly)
Returns the value of attribute m.
7 8 9 |
# File 'lib/fbtxt/document/models/minute.rb', line 7 def m @m end |
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
7 8 9 |
# File 'lib/fbtxt/document/models/minute.rb', line 7 def offset @offset end |
#secs ⇒ Object (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_json ⇒ Object
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_s ⇒ Object
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 |