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.



153
154
155
# File 'lib/zhong/at.rb', line 153

def initialize(ats = [])
  @ats = ats
end

Instance Attribute Details

#atsObject

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_jsonObject



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

#serializeObject



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

def serialize
  MessagePack.pack(as_json)
end

#to_sObject



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

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