Class: ListsConstant::Lookup

Inherits:
Object
  • Object
show all
Defined in:
lib/lists_constant/lookup.rb

Instance Method Summary collapse

Constructor Details

#initialize(base, field) ⇒ Lookup

Returns a new instance of Lookup.



5
6
7
8
# File 'lib/lists_constant/lookup.rb', line 5

def initialize base, field
  @base = base
  @field = field
end

Instance Method Details

#lookup(value) ⇒ Object



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

def lookup value
  I18n.t(value, scope: "#{ListsConstant.namespace}#{@base.name.underscore}.#{@field}")
end