Method: ClassyEnum::Conversion#to_sym

Defined in:
lib/classy_enum/conversion.rb

#to_symObject

Returns a Symbol corresponding to a string representation of element, creating the symbol if it did not previously exist

Example

# Create an Enum with some elements
class Priority < ClassyEnum::Base
end

class Priority::Low < Priority; end
class Priority::Medium < Priority; end
class Priority::High < Priority; end

@priority = Priority::Low.new
@priority.to_sym # => :low


55
56
57
# File 'lib/classy_enum/conversion.rb', line 55

def to_sym
  to_s.to_sym
end