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
- #==(other) ⇒ 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.
153 154 155 |
# File 'lib/zhong/at.rb', line 153 def initialize(ats = []) @ats = ats end |
Instance Attribute Details
#ats ⇒ Object
Returns the value of attribute ats.
151 152 153 |
# File 'lib/zhong/at.rb', line 151 def ats @ats end |
Instance Method Details
#==(other) ⇒ Object
157 158 159 |
# File 'lib/zhong/at.rb', line 157 def ==(other) other.class == self.class && @ats == other.ats end |
#as_json ⇒ Object
169 170 171 |
# File 'lib/zhong/at.rb', line 169 def as_json ats.map(&:as_json) end |
#next_at(time = Time.now) ⇒ Object
161 162 163 |
# File 'lib/zhong/at.rb', line 161 def next_at(time = Time.now) ats.map { |at| at.next_at(time) }.min end |
#serialize ⇒ Object
173 174 175 |
# File 'lib/zhong/at.rb', line 173 def serialize MessagePack.pack(as_json) end |
#to_s ⇒ Object
165 166 167 |
# File 'lib/zhong/at.rb', line 165 def to_s ats.map(&:to_s).join(", ") end |