Class: Scorpion::Attribute
- Inherits:
-
Object
- Object
- Scorpion::Attribute
- Defined in:
- lib/scorpion/attribute.rb
Overview
An injected attribute and it’s configuration.
Attributes collapse
-
#name ⇒ Symbol
The name of the attribute.
Instance Method Summary collapse
- #contract ⇒ Object
-
#initialize(name, contract, lazy: false, public: false, private: false) ⇒ Attribute
constructor
A new instance of Attribute.
- #lazy? ⇒ Object
- #private? ⇒ Object
- #public? ⇒ Object
Constructor Details
#initialize(name, contract, lazy: false, public: false, private: false) ⇒ Attribute
Returns a new instance of Attribute.
44 45 46 47 48 49 50 |
# File 'lib/scorpion/attribute.rb', line 44 def initialize( name, contract, lazy: false, public: false, private: false ) @name = name.to_sym @contract = contract @lazy = lazy @public = public @private = private end |
Instance Attribute Details
#name ⇒ Symbol
Returns the name of the attribute.
11 12 13 |
# File 'lib/scorpion/attribute.rb', line 11 def name @name end |
Instance Method Details
#contract ⇒ Object
16 17 18 19 |
# File 'lib/scorpion/attribute.rb', line 16 def contract @contract = @contract.constantize if @contract.is_a? String @contract end |
#lazy? ⇒ Object
24 25 26 |
# File 'lib/scorpion/attribute.rb', line 24 def lazy? @lazy end |
#private? ⇒ Object
36 37 38 |
# File 'lib/scorpion/attribute.rb', line 36 def private? @private end |
#public? ⇒ Object
30 31 32 |
# File 'lib/scorpion/attribute.rb', line 30 def public? @public end |