Class: Ray::KeyMod

Inherits:
Object
  • Object
show all
Defined in:
lib/ray/dsl/matcher.rb

Instance Method Summary collapse

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

#inspectObject



219
220
221
# File 'lib/ray/dsl/matcher.rb', line 219

def inspect
  "key_mod(#{to_sym})"
end

#to_aObject



207
208
209
# File 'lib/ray/dsl/matcher.rb', line 207

def to_a
  MOD[@symbol]
end

#to_symObject



211
212
213
# File 'lib/ray/dsl/matcher.rb', line 211

def to_sym
  @symbol
end