Class: Surrogate::Value
- Inherits:
-
Object
- Object
- Surrogate::Value
- Defined in:
- lib/surrogate/values.rb
Overview
Superclass for all types of values. Where a value is anything stored in an instance variable on a surrogate, intended to be returned by an api method
Defined Under Namespace
Classes: BaseValue, Raisable, ValueQueue
Class Method Summary collapse
-
.factory(*args, &block) ⇒ Object
convert raw arguments into a value.
Class Method Details
.factory(*args, &block) ⇒ Object
convert raw arguments into a value
7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/surrogate/values.rb', line 7 def self.factory(*args, &block) arg = args.first if args.size > 1 ValueQueue.new args elsif arg.kind_of? Exception Raisable.new arg elsif arg.kind_of? BaseValue arg else BaseValue.new arg end end |