Class: Polytrix::Challenges

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

Instance Method Summary collapse

Instance Method Details

#get(regex) ⇒ Object



3
4
5
6
7
8
# File 'lib/polytrix/challenges.rb', line 3

def get(regex)
  _, v = find do |k, _|
    regex.match k
  end
  v
end

#get_all(regex) ⇒ Object



10
11
12
13
14
# File 'lib/polytrix/challenges.rb', line 10

def get_all(regex)
  select do |k, _|
    regex.match k
  end.values
end