Class: Zhong::MultiAt

Inherits:
Object
  • Object
show all
Defined in:
lib/zhong/at.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#atsObject

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_jsonObject



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

#serializeObject



174
175
176
# File 'lib/zhong/at.rb', line 174

def serialize
  MessagePack.pack(as_json)
end

#to_sObject



166
167
168
# File 'lib/zhong/at.rb', line 166

def to_s
  ats.map(&:to_s).join(", ")
end