Class: Cinch::Ban
- Inherits:
-
Object
- Object
- Cinch::Ban
- Defined in:
- lib/cinch/ban.rb
Instance Attribute Summary collapse
- #by ⇒ User readonly
- #created_at ⇒ Time readonly
-
#extended ⇒ Boolean
readonly
Whether this is an extended ban (as used by for example Freenode).
- #mask ⇒ Mask, String readonly
Instance Method Summary collapse
-
#initialize(mask, by, at) ⇒ Ban
constructor
A new instance of Ban.
-
#match(user) ⇒ Boolean
(also: #=~)
True if the ban matches ‘user`.
- #to_s ⇒ String
Constructor Details
#initialize(mask, by, at) ⇒ Ban
Returns a new instance of Ban.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cinch/ban.rb', line 19 def initialize(mask, by, at) @by, @created_at = by, at if mask =~ /^\$/ @extended = true @mask = mask else @extended = false @mask = Mask.new(mask) end end |
Instance Attribute Details
#created_at ⇒ Time (readonly)
11 12 13 |
# File 'lib/cinch/ban.rb', line 11 def created_at @created_at end |
#extended ⇒ Boolean (readonly)
Returns whether this is an extended ban (as used by for example Freenode).
14 15 16 |
# File 'lib/cinch/ban.rb', line 14 def extended @extended end |
Instance Method Details
#match(user) ⇒ Boolean Also known as: =~
Returns true if the ban matches ‘user`.
33 34 35 36 |
# File 'lib/cinch/ban.rb', line 33 def match(user) raise UnsupportedFeature, "extended bans (freenode) are not supported yet" if @extended @mask =~ user end |