Module: Keys

Defined in:
lib/key_dial.rb

Overview

Ability to create anonymous key lists (on no particular object) with Keys[b]

Defined Under Namespace

Classes: Missing

Constant Summary collapse

MISSING =
Missing.new.freeze

Class Method Summary collapse

Class Method Details

.[](first_key) ⇒ Object

Create a new key list (KeyDialler) object using the syntax Keys[…]



131
132
133
# File 'lib/key_dial.rb', line 131

def self.[](first_key)
	return KeyDial::KeyDialler.new(nil, first_key)
end

.index?(key) ⇒ Boolean

Checks if a key is a valid numeric index, i.e. can be used in the syntax object

Parameters:

  • key

    The key to check.

Returns:

  • (Boolean)

    True if the key is a valid numeric index, otherwise false.



141
142
143
# File 'lib/key_dial.rb', line 141

def self.index?(key)
	return key.is_a?(Numeric) && key.respond_to?(:to_i)
end