Class: RgGen::Core::InputBase::Property
- Defined in:
- lib/rggen/core/input_base/property.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
- #define(feature) ⇒ Object
- #evaluate(feature) ⇒ Object
-
#initialize(name, options, &body) ⇒ Property
constructor
A new instance of Property.
Constructor Details
#initialize(name, options, &body) ⇒ Property
Returns a new instance of Property.
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rggen/core/input_base/property.rb', line 11 def initialize(name, , &body) @name = name @options = @costom_property = if [:body] create_costom_property(&[:body]) elsif block_given? create_costom_property(&body) end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
22 23 24 |
# File 'lib/rggen/core/input_base/property.rb', line 22 def name @name end |
Class Method Details
.define(feature, name, **options, &body) ⇒ Object
7 8 9 |
# File 'lib/rggen/core/input_base/property.rb', line 7 def self.define(feature, name, **, &body) new(name, , &body).define(feature) end |
Instance Method Details
#define(feature) ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/rggen/core/input_base/property.rb', line 24 def define(feature) feature.class_exec(self) do |property| define_method(property.name) do |*args, **kwargs, &block| property.evaluate(self, *args, **kwargs, &block) end end end |
#evaluate(feature) ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/rggen/core/input_base/property.rb', line 32 def evaluate(feature, ...) feature.verify(@options[:verify]) if @options.key?(:verify) if proxy_property? proxy_property(feature, ...) else default_property(feature) end end |