123456789_123456789_123456789_123456789_123456789_

Class: Reline::Key

Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Struct
Instance Chain:
self, Struct
Inherits: Struct
  • Object
Defined in: lib/reline.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#char (rw)

[ GitHub ]

  
# File 'lib/reline.rb', line 20

Key = Struct.new(:char, :combined_char, :with_meta)

#combined_char (rw)

[ GitHub ]

  
# File 'lib/reline.rb', line 20

Key = Struct.new(:char, :combined_char, :with_meta)

#with_meta (rw)

[ GitHub ]

  
# File 'lib/reline.rb', line 20

Key = Struct.new(:char, :combined_char, :with_meta)

Instance Method Details

#==(other)

Alias for #match?.

[ GitHub ]

  
# File 'lib/reline.rb', line 34

alias_method :==, :match?

#match?(other) ⇒ Boolean Also known as: #==

[ GitHub ]

  
# File 'lib/reline.rb', line 21

def match?(other)
  case other
  when Reline::Key
    (other.char.nil? or char.nil? or char == other.char) and
    (other.combined_char.nil? or combined_char.nil? or combined_char == other.combined_char) and
    (other.with_meta.nil? or with_meta.nil? or with_meta == other.with_meta)
  when Integer, Symbol
    (combined_char and combined_char == other) or
    (combined_char.nil? and char and char == other)
  else
    false
  end
end