Class: SCParse::CommandHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/scparse.rb

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object

Find first key that begins with the name passed



46
47
48
49
# File 'lib/scparse.rb', line 46

def [](name)
  possible = keys.select {|key| key =~ /^#{name}.*/}
  fetch(possible[0]) if possible.length == 1
end