Class: Zhong::MultiAt
- Inherits:
-
Object
- Object
- Zhong::MultiAt
- Defined in:
- lib/zhong/at.rb
Instance Attribute Summary collapse
-
#ats ⇒ Object
Returns the value of attribute ats.
Instance Method Summary collapse
- #==(o) ⇒ Object
- #as_json ⇒ Object
-
#initialize(ats = []) ⇒ MultiAt
constructor
A new instance of MultiAt.
- #next_at(time = Time.now) ⇒ Object
- #serialize ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(ats = []) ⇒ MultiAt
Returns a new instance of MultiAt.
154 155 156 |
# File 'lib/zhong/at.rb', line 154 def initialize(ats = []) @ats = ats end |
Instance Attribute Details
#ats ⇒ Object
Returns the value of attribute ats.
152 153 154 |
# File 'lib/zhong/at.rb', line 152 def ats @ats end |
Instance Method Details
#==(o) ⇒ Object
158 159 160 |
# File 'lib/zhong/at.rb', line 158 def ==(o) o.class == self.class && @ats == o.ats end |
#as_json ⇒ Object
170 171 172 |
# File 'lib/zhong/at.rb', line 170 def as_json ats.map(&:as_json) end |
#next_at(time = Time.now) ⇒ Object
162 163 164 |
# File 'lib/zhong/at.rb', line 162 def next_at(time = Time.now) ats.map { |at| at.next_at(time) }.min end |
#serialize ⇒ Object
174 175 176 |
# File 'lib/zhong/at.rb', line 174 def serialize MessagePack.pack(as_json) end |
#to_s ⇒ Object
166 167 168 |
# File 'lib/zhong/at.rb', line 166 def to_s ats.map(&:to_s).join(", ") end |