class Attrocity::ValueExtractor

Attributes

coercer[R]
data[R]
mapper[R]

Public Class Methods

new(data, mapper:, coercer:) click to toggle source
# File lib/attrocity/value_extractor.rb, line 5
def initialize(data, mapper:, coercer:)
  @data, @mapper, @coercer = data, mapper, coercer
end

Public Instance Methods

value() click to toggle source
# File lib/attrocity/value_extractor.rb, line 9
def value
  coerce(map)
end

Private Instance Methods

coerce(value) click to toggle source
# File lib/attrocity/value_extractor.rb, line 19
def coerce(value)
  coercer.coerce(value)
end
map() click to toggle source
# File lib/attrocity/value_extractor.rb, line 15
def map
  mapper.call(nil, data)
end