Class: LunaPark::Entities::Nested
- Inherits:
-
Attributable
- Object
- Simple
- Attributable
- LunaPark::Entities::Nested
- Defined in:
- lib/luna_park/entities/nested.rb
Overview
add description
Class Method Summary collapse
-
.namespace(name, &block) ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods included from LunaPark::Extensions::Dsl::Attributes
#attr, #attr?, #attrs, #attrs?
Methods included from LunaPark::Extensions::TypedAttrAccessor
#typed_attr_accessor, #typed_attr_writer
Methods included from LunaPark::Extensions::PredicateAttrAccessor
#predicate_attr_accessor, #predicate_attr_reader
Methods included from LunaPark::Extensions::Serializable
Methods included from LunaPark::Extensions::Comparable
Methods inherited from Simple
#==, #eql?, #initialize, #serialize, #to_h
Methods included from LunaPark::Extensions::Wrappable
Constructor Details
This class inherits a constructor from LunaPark::Entities::Simple
Class Method Details
.namespace(name, &block) ⇒ Object
rubocop:disable Metrics/MethodLength
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/luna_park/entities/nested.rb', line 9 def self.namespace(name, &block) # rubocop:disable Metrics/MethodLength serializable_attributes(name) comparable_attributes(name) namespace_class = Class.new(Nested) namespace_class.define_singleton_method(:name) { "Namespace:#{name}" } namespace_class.class_eval(&block) anonym_mixin = Module.new do attr_reader(name) define_method(:"#{name}=") do |input| instance_variable_set(:"@#{name}", namespace_class.wrap(input)) end end include(anonym_mixin) end |