Module: Hospodar::Builder
- Defined in:
- lib/hospodar/builder.rb,
lib/hospodar/builder/id.rb,
lib/hospodar/builder/error.rb,
lib/hospodar/builder/proxy.rb,
lib/hospodar/builder/nested.rb,
lib/hospodar/builder/flatten.rb,
lib/hospodar/builder/helpers.rb,
lib/hospodar/builder/wrapped.rb,
lib/hospodar/builder/assembler.rb,
lib/hospodar/builder/exeptional.rb,
lib/hospodar/builder/strategies/init.rb,
lib/hospodar/builder/strategies/link.rb,
lib/hospodar/builder/strategies/mount.rb,
lib/hospodar/builder/strategies/inject.rb,
lib/hospodar/builder/strategies/execute.rb,
lib/hospodar/builder/instantiation_error.rb,
lib/hospodar/builder/strategies/enumerate.rb,
lib/hospodar/builder/strategies/translate.rb
Overview
Introduces possibilty to build complex objects by schema
Defined Under Namespace
Modules: ClassMethods, InheritanceHelpers
Classes: BuilderParams, Error, Flatten, Id, InstantiationError, Nested, Wrapped
Class Method Summary
collapse
Class Method Details
.create_error(exc, id) ⇒ Object
47
48
49
50
51
|
# File 'lib/hospodar/builder.rb', line 47
def self.create_error(exc, id)
new_error = Error.new(exc.message, id)
new_error.set_backtrace(exc.backtrace)
new_error
end
|
.create_init_error(exc, id, init_attrs) ⇒ Object
41
42
43
44
45
|
# File 'lib/hospodar/builder.rb', line 41
def self.create_init_error(exc, id, init_attrs)
new_error = InstantiationError.new(id, init_attrs)
new_error.set_backtrace(exc.backtrace)
new_error
end
|
.def_accessor(accessor, on:, to:, delegate: false) ⇒ Object
53
54
55
56
57
|
# File 'lib/hospodar/builder.rb', line 53
def self.def_accessor(accessor, on:, to:, delegate: false)
on.define_singleton_method(:ms_predecessor) { accessor }
on.define_singleton_method(accessor) { to }
on.extend(MethodMissingDelegation) if delegate
end
|
.included(receiver) ⇒ Object
105
106
107
108
109
110
111
|
# File 'lib/hospodar/builder.rb', line 105
def self.included(receiver)
receiver.extend ClassMethods
receiver.extend InheritanceHelpers
receiver.on_exception do |e, _result|
raise e
end
end
|