Class: Protein::GetConst

Inherits:
Object
  • Object
show all
Defined in:
lib/protein/get_const.rb

Class Method Summary collapse

Class Method Details

.call(input) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/protein/get_const.rb', line 4

def call(input)
  if input.is_a?(String)
    Object.const_get(input)
  elsif input != nil
    input
  else
    raise DefinitionError, "unset required option"
  end
end

.map(array) ⇒ Object



14
15
16
# File 'lib/protein/get_const.rb', line 14

def map(array)
  array.map { |input| call(input) }
end