lib/representable/definition.rb in representable-3.0.4 vs lib/representable/definition.rb in representable-3.1.0
- old
+ new
@@ -1,8 +1,12 @@
-require "representable/populator"
+require 'declarative/definitions'
module Representable
+ autoload :Pipeline, "representable/pipeline"
+ autoload :Populator, "representable/populator"
+ autoload :Option, "representable/option"
+
# Created at class compile time. Keeps configuration options for one property.
class Definition < ::Declarative::Definitions::Definition
def initialize(sym, options={}, &block)
options[:extend] = options[:nested] if options[:nested]
@@ -51,10 +55,11 @@
self[:class] or self[:extend] or self[:instance]
end
def representable?
return if self[:representable] == false
+
self[:representable] or typed?
end
def array?
self[:collection]
@@ -99,10 +104,10 @@
# at runtime, its value never changes).
def runtime_options!(options)
@runtime_options = {}
for name, value in options
- value = ::Declarative::Option(value, instance_exec: true, callable: Uber::Callable) if dynamic_options.include?(name)
+ value = ::Representable::Option(value) if dynamic_options.include?(name)
@runtime_options[name] = value
end
end
def dynamic_options