Method: OpenGraphReader::Object::DSL#define_single
- Defined in:
- lib/open_graph_reader/object/dsl.rb
#define_single(name, options, args, processor) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/open_graph_reader/object/dsl.rb', line 81 def define_single name, , args, processor define_method(name) do properties[name.to_s] || [:default] end define_method("#{name}=") do |value| # @todo figure out a sane way to distinguish subobject properties unless value.is_a? Object value.downcase! if [:downcase] value = processor.call(value, *args, ) end properties[name.to_s] = value end end |