Class: HumanAttributes::Formatters::Enumerize

Inherits:
Base
  • Object
show all
Defined in:
lib/human_attributes/formatters/enumerize.rb

Constant Summary

Constants included from Config

Config::TYPES

Instance Attribute Summary

Attributes inherited from Base

#attribute, #default, #options, #suffix, #type

Instance Method Summary collapse

Methods inherited from Base

#initialize, #method_name

Methods included from Config

#category_by_type, #formatter_by_type, #known_type?, #raise_error, #suffix_by_type, #type_config

Constructor Details

This class inherits a constructor from HumanAttributes::Formatters::Base

Instance Method Details

#apply(_instance, value) ⇒ Object



4
5
6
7
8
# File 'lib/human_attributes/formatters/enumerize.rb', line 4

def apply(_instance, value)
  return unless value
  raise_error('NotEnumerizeAttribute') unless value.class.to_s == "Enumerize::Value"
  value.text
end