Module: HashDial

Included in:
Hash
Defined in:
lib/hash_dial.rb,
lib/hash_dial/version.rb,
lib/hash_dial/hash_dialler.rb

Defined Under Namespace

Classes: HashDialler

Constant Summary collapse

VERSION =
"1.0.2"

Instance Method Summary collapse

Instance Method Details

#call(*lookup) ⇒ Object

Called directly on a Hash, immediately dials and calls the hash keys specified as arguments. Returns the value found, or nil.

Parameters:

  • lookup

    The hash keys to attempt to retrieve.



20
21
22
# File 'lib/hash_dial.rb', line 20

def call(*lookup)
    return HashDialler.new(self, *lookup).call
end

#to_dial(*lookup) ⇒ Object Also known as: dial

Called on a Hash, returns a HashDialler object for that Hash.

Parameters:

  • lookup

    Parameters to this method form initial hash keys to dial. This is unnecessary but works anyway. For simplicity, dial hash keys by accessing them as if HashDialler were a Hash.



10
11
12
# File 'lib/hash_dial.rb', line 10

def to_dial(*lookup)
    return HashDialler.new(self, *lookup)
end