Class: Reactor::Cm::XmlAttribute
- Inherits:
-
Object
- Object
- Reactor::Cm::XmlAttribute
- Defined in:
- lib/reactor/cm/xml_attribute.rb
Constant Summary collapse
- AVAILABLE_SCOPES =
%i(get set create).freeze
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#scopes ⇒ Object
Returns the value of attribute scopes.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(name, type, options) ⇒ XmlAttribute
constructor
A new instance of XmlAttribute.
- #scope?(name) ⇒ Boolean
Constructor Details
#initialize(name, type, options) ⇒ XmlAttribute
Returns a new instance of XmlAttribute.
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/reactor/cm/xml_attribute.rb', line 8 def initialize(name, type, ) @name = name @type = type.presence || :string @scopes = if [:except].present? AVAILABLE_SCOPES - [:except] elsif [:only].present? [:only] else AVAILABLE_SCOPES end end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/reactor/cm/xml_attribute.rb', line 6 def name @name end |
#scopes ⇒ Object
Returns the value of attribute scopes.
6 7 8 |
# File 'lib/reactor/cm/xml_attribute.rb', line 6 def scopes @scopes end |
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/reactor/cm/xml_attribute.rb', line 6 def type @type end |
Instance Method Details
#scope?(name) ⇒ Boolean
22 23 24 |
# File 'lib/reactor/cm/xml_attribute.rb', line 22 def scope?(name) scopes.include?(name) end |