class Dry::Data::Default

Attributes

value[R]

Public Class Methods

new(type, options) click to toggle source
Calls superclass method Dry::Data::Decorator::new
# File lib/dry/data/default.rb, line 11
def initialize(type, options)
  super
  @value = options.fetch(:value)
end

Public Instance Methods

[](input)
Alias for: call
call(input) click to toggle source
# File lib/dry/data/default.rb, line 16
def call(input)
  input.nil? ? value : type[input]
end
Also aliased as: []