Class: Reactor::Cm::XmlAttribute
- Inherits:
-
Object
- Object
- Reactor::Cm::XmlAttribute
- Defined in:
- lib/reactor/cm/xml_attribute.rb
Constant Summary collapse
- AVAILABLE_SCOPES =
[:get, :set, :create]
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.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/reactor/cm/xml_attribute.rb', line 14 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.
10 11 12 |
# File 'lib/reactor/cm/xml_attribute.rb', line 10 def name @name end |
#scopes ⇒ Object
Returns the value of attribute scopes.
12 13 14 |
# File 'lib/reactor/cm/xml_attribute.rb', line 12 def scopes @scopes end |
#type ⇒ Object
Returns the value of attribute type.
11 12 13 |
# File 'lib/reactor/cm/xml_attribute.rb', line 11 def type @type end |
Instance Method Details
#scope?(name) ⇒ Boolean
28 29 30 |
# File 'lib/reactor/cm/xml_attribute.rb', line 28 def scope?(name) self.scopes.include?(name) end |