Module: LLT::Helpers::Constantize
- Defined in:
- lib/llt/helpers/constantize.rb
Instance Method Summary collapse
Instance Method Details
#constant_by_type(type = @type, prefix: "", suffix: "", namespace: LLT) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/llt/helpers/constantize.rb', line 4 def constant_by_type(type = @type, prefix: "", suffix: "", namespace: LLT) raise ArgumentError.new("type cannot be nil") if type.nil? t = begin Terminology.send(type, :full) rescue type end scope = namespace || self.class arg = "#{classified(prefix)}#{classified(t)}#{classified(suffix)}" scope.const_get(arg) end |