class ParamsReady::AbstractBuilder
Public Class Methods
define_parameter(type, *args, **opts, &block)
click to toggle source
# File lib/params_ready/builder.rb, line 31 def self.define_parameter(type, *args, **opts, &block) builder_class = builder(type) builder = builder_class.instance(*args, **opts) builder.include(&block) unless block.nil? builder.build end
define_registered_parameter(name, *args, **opts, &block)
click to toggle source
# File lib/params_ready/builder.rb, line 38 def self.define_registered_parameter(name, *args, **opts, &block) full_name = "define_#{name}" send(full_name, *args, **opts, &block) end
instance(*args, **opts)
click to toggle source
# File lib/params_ready/builder.rb, line 51 def self.instance(*args, **opts) new *args, **opts end
new(definition)
click to toggle source
# File lib/params_ready/builder.rb, line 57 def initialize(definition) @definition = definition end
register(name)
click to toggle source
# File lib/params_ready/builder.rb, line 27 def self.register(name) register_builder(name, self) end
resolve(input, *args, **opts, &block)
click to toggle source
# File lib/params_ready/builder.rb, line 43 def self.resolve(input, *args, **opts, &block) if input.is_a? Parameter::AbstractDefinition input else define_registered_parameter(input, *args, **opts, &block) end end
Public Instance Methods
build()
click to toggle source
# File lib/params_ready/builder.rb, line 72 def build @definition.finish @definition end
fetch()
click to toggle source
# File lib/params_ready/builder.rb, line 66 def fetch d = @definition @definition = nil d end
include(&block)
click to toggle source
# File lib/params_ready/builder.rb, line 61 def include(&block) instance_eval(&block) self end
open?()
click to toggle source
# File lib/params_ready/builder.rb, line 77 def open? return false if @definition.nil? return false if @definition.frozen? true end