Class: Representable::Config
- Includes:
- InheritMethods, InheritableArray
- Defined in:
- lib/representable/config.rb
Overview
NOTE: the API of Config is subject to change so don’t rely too much on this private object.
Defined Under Namespace
Modules: InheritMethods, InheritableArray
Instance Attribute Summary collapse
-
#wrap ⇒ Object
Returns the value of attribute wrap.
Instance Method Summary collapse
- #<<(definition) ⇒ Object
- #[](name) ⇒ Object
- #each(*args, &block) ⇒ Object
-
#options ⇒ Object
Write representer configuration into this hash.
-
#wrap_for(name) ⇒ Object
Computes the wrap string or returns false.
Methods included from InheritableArray
#inherit, #inheritable_array, #inheritable_arrays
Methods included from InheritMethods
Methods included from Hash
#from_hash, included, #to_hash
Instance Attribute Details
#wrap ⇒ Object
Returns the value of attribute wrap.
34 35 36 |
# File 'lib/representable/config.rb', line 34 def wrap @wrap end |
Instance Method Details
#<<(definition) ⇒ Object
22 23 24 |
# File 'lib/representable/config.rb', line 22 def <<(definition) self[definition.name] = definition end |
#[](name) ⇒ Object
26 27 28 |
# File 'lib/representable/config.rb', line 26 def [](name) fetch(name.to_s, nil) end |
#each(*args, &block) ⇒ Object
30 31 32 |
# File 'lib/representable/config.rb', line 30 def each(*args, &block) values.each(*args, &block) end |
#options ⇒ Object
Write representer configuration into this hash.
44 45 46 |
# File 'lib/representable/config.rb', line 44 def @options ||= {} end |
#wrap_for(name) ⇒ Object
Computes the wrap string or returns false.
37 38 39 40 41 |
# File 'lib/representable/config.rb', line 37 def wrap_for(name) return unless wrap return infer_name_for(name) if wrap === true wrap end |