Class: Xommelier::Xml::Element::Structure::Property
- Inherits:
-
Object
- Object
- Xommelier::Xml::Element::Structure::Property
- Defined in:
- lib/xommelier/xml/element/structure/property.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #complex_type? ⇒ Boolean
- #default ⇒ Object
-
#default? ⇒ true, false
Has default value?.
-
#initialize(name, options) ⇒ Property
constructor
A new instance of Property.
- #inspect ⇒ Object
- #ns ⇒ Xommelier::Xml::Namespace
- #type ⇒ Class
- #writer ⇒ Object
Constructor Details
#initialize(name, options) ⇒ Property
Returns a new instance of Property.
13 14 15 16 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 13 def initialize(name, ) @name = name @options = self.class.const_get(:DEFAULTS).merge() end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 18 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
18 19 20 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 18 def @options end |
Instance Method Details
#complex_type? ⇒ Boolean
38 39 40 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 38 def complex_type? type < Xml::Element end |
#default ⇒ Object
29 30 31 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 29 def default [:default] end |
#default? ⇒ true, false
Returns has default value?.
43 44 45 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 43 def default? .key?(:default) && required? end |
#inspect ⇒ Object
47 48 49 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 47 def inspect "#<Xommelier::X::E::S::#{self.class.name.demodulize}:0x#{object_id.to_s(16)} #{instance_variables.map { |ivar| "#{ivar}=#{instance_variable_get(ivar).inspect}" }.join(' ')}>" end |
#ns ⇒ Xommelier::Xml::Namespace
25 26 27 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 25 def ns [:ns] end |
#type ⇒ Class
34 35 36 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 34 def type [:type] end |
#writer ⇒ Object
20 21 22 |
# File 'lib/xommelier/xml/element/structure/property.rb', line 20 def writer @writer ||= "#{name}=" end |