module Dry::Data::Decorator
Attributes
options[R]
type[R]
Public Class Methods
new(type, options = {})
click to toggle source
# File lib/dry/data/decorator.rb, line 6 def initialize(type, options = {}) @type = type @options = options end
Public Instance Methods
constructor()
click to toggle source
# File lib/dry/data/decorator.rb, line 11 def constructor type.constructor end
respond_to_missing?(meth, include_private = false)
click to toggle source
Calls superclass method
# File lib/dry/data/decorator.rb, line 19 def respond_to_missing?(meth, include_private = false) super || type.respond_to?(meth) end
valid?(input)
click to toggle source
# File lib/dry/data/decorator.rb, line 15 def valid?(input) type.valid?(input) end
with(new_options)
click to toggle source
# File lib/dry/data/decorator.rb, line 23 def with(new_options) self.class.new(type, options.merge(new_options)) end
Private Instance Methods
method_missing(meth, *args, &block)
click to toggle source
Calls superclass method
# File lib/dry/data/decorator.rb, line 29 def method_missing(meth, *args, &block) if type.respond_to?(meth) response = type.__send__(meth, *args, &block) if response.kind_of?(type.class) self.class.new(response, options) else response end else super end end