Class: HumanistErrors::RegexHash

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

Instance Method Summary collapse

Instance Method Details

#[](value) ⇒ Object



3
4
5
6
7
8
9
10
# File 'lib/humanist_errors/regex_hash.rb', line 3

def [](value)
  result = self.select { |k| k =~ value }
  if result.empty?
    :no_result
  else
    result.shift[1]
  end
end