module ParamsReady::Parameter::DelegatingParameter

Public Class Methods

included(recipient) click to toggle source
# File lib/params_ready/parameter/parameter.rb, line 38
def self.included(recipient)
  recipient.freeze_variable :data
end

Public Instance Methods

==(other) click to toggle source
# File lib/params_ready/parameter/parameter.rb, line 70
def ==(other)
  return false unless self.match?(other)
  data == other.data
end
Also aliased as: eql?
eql?(other)
Alias for: ==
hash() click to toggle source
# File lib/params_ready/parameter/parameter.rb, line 66
def hash
  [definition, data].hash
end
method_missing(name, *args) click to toggle source
Calls superclass method
# File lib/params_ready/parameter/parameter.rb, line 42
def method_missing(name, *args)
  if @data.respond_to?(name)
    @data.send name, *args
  else
    super
  end
end
respond_to_missing?(name, include_private = false) click to toggle source
Calls superclass method
# File lib/params_ready/parameter/parameter.rb, line 50
def respond_to_missing?(name, include_private = false)
  if @data.respond_to?(name, include_private)
    true
  else
    super
  end
end
set_value(input, context = Format.instance(:backend), validator = nil) click to toggle source
Calls superclass method
# File lib/params_ready/parameter/parameter.rb, line 58
def set_value(input, context = Format.instance(:backend), validator = nil)
  if self.match?(input)
    super input.unwrap, context, validator
  else
    super
  end
end

Protected Instance Methods

child_for_update(path) click to toggle source
# File lib/params_ready/parameter/parameter.rb, line 79
def child_for_update(path)
  [@data, nil, *path]
end
populate_other(other) click to toggle source
# File lib/params_ready/parameter/parameter.rb, line 98
def populate_other(other)
  data.populate_other(other.data)
end
set_from_input(input, context, validator) click to toggle source
Calls superclass method
# File lib/params_ready/parameter/parameter.rb, line 90
def set_from_input(input, context, validator)
  if self.match?(input)
    super input.unwrap, context, validator
  else
    super
  end
end
updated_clone(_child_name, updated) click to toggle source
# File lib/params_ready/parameter/parameter.rb, line 83
def updated_clone(_child_name, updated)
  clone = definition.create
  clone.instance_variable_set :@data, updated
  clone.freeze if frozen?
  clone
end