Module: Representable::Binding::Deprecation::EvaluateOption

Defined in:
lib/representable/deprecations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(includer) ⇒ Object



37
38
39
40
# File 'lib/representable/deprecations.rb', line 37

def self.included(includer)
  super
  includer.extend(Build)
end

Instance Method Details

#compile_fragment(options) ⇒ Object



109
110
111
112
113
# File 'lib/representable/deprecations.rb', line 109

def compile_fragment(options)
  @represented = options[:represented]
  @parent_decorator = options[:decorator]
  super
end

#evaluate_option(name, input = nil, options = {}) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/representable/deprecations.rb', line 42

def evaluate_option(name, input=nil, options={})
  return evaluate_option_with_deprecation(name, input, options, :user_options) if name==:as
  return evaluate_option_with_deprecation(name, input, options, :user_options) if name==:if
  return evaluate_option_with_deprecation(name, input, options, :user_options) if name==:getter
  return evaluate_option_with_deprecation(name, input, options, :doc, :user_options) if name==:writer
  return evaluate_option_with_deprecation(name, input, options, :input, :user_options) if name==:skip_render
  return evaluate_option_with_deprecation(name, input, options, :input, :user_options) if name==:skip_parse
  return evaluate_option_with_deprecation(name, input, options, :input, :user_options) if name==:serialize
  return evaluate_option_with_deprecation(name, input, options, :doc, :user_options) if name==:reader
  return evaluate_option_with_deprecation(name, input, options, :input, :index, :user_options) if name==:instance
  return evaluate_option_with_deprecation(name, input, options, :input, :index, :user_options) if name==:class
  return evaluate_option_with_deprecation(name, input, options, :input, :fragment, :user_options) if name==:deserialize
  return evaluate_option_with_deprecation(name, input, options, :input, :user_options) if name==:prepare
  return evaluate_option_with_deprecation(name, input, options, :input, :user_options) if name==:extend
  return evaluate_option_with_deprecation(name, input, options, :input, :user_options) if name==:setter
end

#get(options = {}) ⇒ Object

DISCUSS: evluate if we really need this.



122
123
124
125
# File 'lib/representable/deprecations.rb', line 122

def get(options={}) # DISCUSS: evluate if we really need this.
  warn "[Representable] Binding#get is deprecated."
  self[:getter] ? Representable::Getter.(nil, options.merge(binding: self)) : Representable::GetValue.(nil, options.merge(binding: self))
end

#representedObject



104
105
106
107
# File 'lib/representable/deprecations.rb', line 104

def represented
  warn "[Representable] Binding#represented is deprecated. Use options[:represented] instead."
  @represented
end

#uncompile_fragment(options) ⇒ Object

Parse value from doc and update the model property.



116
117
118
119
120
# File 'lib/representable/deprecations.rb', line 116

def uncompile_fragment(options)
  @represented = options[:represented]
  @parent_decorator = options[:decorator]
  super
end