Class: Fixturama::Loader::Value
- Inherits:
-
Object
- Object
- Fixturama::Loader::Value
- Defined in:
- lib/fixturama/loader/value.rb
Overview
Wraps a value with a reference to its key in the [Fixturama::Loader::Context]
Constant Summary collapse
- MATCHER =
Regex mather to extract value key from the stringified wrapper
/\A\#\<Fixturama::Loader::Context\[([^\]]+)\]\>\z/.freeze
Class Method Summary collapse
Instance Method Summary collapse
-
#to_s ⇒ Object
(also: #to_str)
The sting representing the value with a reference to it in bindings.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object (private)
31 32 33 |
# File 'lib/fixturama/loader/value.rb', line 31 def method_missing(name, *args, &block) @value.respond_to?(name) ? @value.send(name, *args, &block) : super end |
Class Method Details
.new(key, value) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/fixturama/loader/value.rb', line 11 def self.new(key, value) case value when String, Symbol, Numeric, TrueClass, FalseClass, NilClass then value else super end end |
Instance Method Details
#to_s ⇒ Object Also known as: to_str
The sting representing the value with a reference to it in bindings
19 20 21 |
# File 'lib/fixturama/loader/value.rb', line 19 def to_s "\"#<Fixturama::Loader::Context[#{@key}]>\"" end |