Class: SmartCore::Initializer::AttributeDefiner Private
- Inherits:
-
Object
- Object
- SmartCore::Initializer::AttributeDefiner
- Defined in:
- lib/smart_core/initializer/attribute_definer.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #define_option(option_name, option_type = :__any__, **options) ⇒ void private
- #define_options(*option_names) ⇒ void private
- #define_param(param_name, param_type = :__any__, **options) ⇒ void private
- #define_params(*param_names) ⇒ void private
- #initialize(processed_klass) ⇒ void constructor private
Constructor Details
#initialize(processed_klass) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 14 |
# File 'lib/smart_core/initializer/attribute_definer.rb', line 11 def initialize(processed_klass) @processed_klass = processed_klass @definition_lock = Mutex.new end |
Instance Method Details
#define_option(option_name, option_type = :__any__, **options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
53 54 55 56 57 58 59 60 |
# File 'lib/smart_core/initializer/attribute_definer.rb', line 53 def define_option(option_name, option_type = :__any__, **) thread_safe do option = build_attribute(option_name, option_type, **) prevent_intersection_with_already_defined_param(option) append_option(option) end end |
#define_options(*option_names) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/smart_core/initializer/attribute_definer.rb', line 67 def (*option_names) thread_safe do = option_names.map do |option_name| build_attribute(option_name).tap do |option| prevent_intersection_with_already_defined_param(option) end end .each { |option| append_option(option) } end end |
#define_param(param_name, param_type = :__any__, **options) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
22 23 24 25 26 27 28 |
# File 'lib/smart_core/initializer/attribute_definer.rb', line 22 def define_param(param_name, param_type = :__any__, **) thread_safe do parameter = build_attribute(param_name, param_type, **) prevent_intersection_with_already_defined_option(parameter) append_parameter(parameter) end end |
#define_params(*param_names) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/smart_core/initializer/attribute_definer.rb', line 35 def define_params(*param_names) thread_safe do parameters = param_names.map do |param_name| build_attribute(param_name).tap do |parameter| prevent_intersection_with_already_defined_option(parameter) end end parameters.each { |parameter| append_parameter(parameter) } end end |