Class: Pili::StreamInfo
- Inherits:
-
Object
- Object
- Pili::StreamInfo
- Defined in:
- lib/pili/stream.rb
Instance Attribute Summary collapse
-
#disabled_till ⇒ Object
readonly
表示禁用结束的时间, 0 表示不禁用, -1 表示永久禁用.
-
#hub ⇒ Object
readonly
Returns the value of attribute hub.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #disabled? ⇒ Boolean
-
#initialize(hub, key, disabled_till) ⇒ StreamInfo
constructor
A new instance of StreamInfo.
- #to_json ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(hub, key, disabled_till) ⇒ StreamInfo
Returns a new instance of StreamInfo.
12 13 14 15 16 |
# File 'lib/pili/stream.rb', line 12 def initialize(hub, key, disabled_till) @hub = hub @key = key @disabled_till = disabled_till end |
Instance Attribute Details
#disabled_till ⇒ Object (readonly)
表示禁用结束的时间, 0 表示不禁用, -1 表示永久禁用.
10 11 12 |
# File 'lib/pili/stream.rb', line 10 def disabled_till @disabled_till end |
#hub ⇒ Object (readonly)
Returns the value of attribute hub.
7 8 9 |
# File 'lib/pili/stream.rb', line 7 def hub @hub end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/pili/stream.rb', line 7 def key @key end |
Instance Method Details
#disabled? ⇒ Boolean
18 19 20 |
# File 'lib/pili/stream.rb', line 18 def disabled? @disabled_till == -1 || @disabled_till > Time.new.to_i end |
#to_json ⇒ Object
26 27 28 |
# File 'lib/pili/stream.rb', line 26 def to_json {:hub=>@hub, :key=>@key, :disabled=>disabled?}.to_json end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/pili/stream.rb', line 22 def to_s "#<#{self.class} #{@hub}/#{@key} disabled:#{disabled?}>" end |