Class: Ray::KeyMod
- Inherits:
-
Object
- Object
- Ray::KeyMod
- Defined in:
- lib/ray/dsl/matcher.rb
Instance Method Summary collapse
- #===(other) ⇒ Object
-
#initialize(name) ⇒ KeyMod
constructor
A new instance of KeyMod.
- #inspect ⇒ Object
- #to_a ⇒ Object
- #to_sym ⇒ Object
Constructor Details
#initialize(name) ⇒ KeyMod
Returns a new instance of KeyMod.
203 204 205 |
# File 'lib/ray/dsl/matcher.rb', line 203 def initialize(name) @symbol = name.to_sym end |
Instance Method Details
#===(other) ⇒ Object
215 216 217 |
# File 'lib/ray/dsl/matcher.rb', line 215 def ===(other) other.is_a?(Integer) && to_a.any? { |const| (o & const) != 0 } end |
#inspect ⇒ Object
219 220 221 |
# File 'lib/ray/dsl/matcher.rb', line 219 def inspect "key_mod(#{to_sym})" end |
#to_a ⇒ Object
207 208 209 |
# File 'lib/ray/dsl/matcher.rb', line 207 def to_a MOD[@symbol] end |
#to_sym ⇒ Object
211 212 213 |
# File 'lib/ray/dsl/matcher.rb', line 211 def to_sym @symbol end |