class Dry::Data::Enum
Attributes
values[R]
Public Class Methods
new(type, options)
click to toggle source
Calls superclass method
Dry::Data::Decorator::new
# File lib/dry/data/enum.rb, line 10 def initialize(type, options) super @values = options.fetch(:values).freeze @values.each(&:freeze) end
Public Instance Methods
call(input)
click to toggle source
# File lib/dry/data/enum.rb, line 16 def call(input) case input when Fixnum then type[values[input]] else type[input] end end
Also aliased as: []