Module: ROXML::ClassMethods::Accessors
- Defined in:
- lib/roxml.rb
Instance Method Summary collapse
-
#roxml_attrs ⇒ Object
Returns array of internal reference objects, such as attributes and composed XML objects.
-
#roxml_namespace ⇒ Object
:nodoc:.
-
#roxml_tag_name ⇒ Object
:nodoc:.
-
#tag_name ⇒ Object
Returns the tag name (also known as xml_name) of the class.
-
#tag_refs ⇒ Object
:nodoc:.
-
#xml_construction_args ⇒ Object
:nodoc:.
-
#xml_name? ⇒ Boolean
A helper which enables us to detect when the xml_name has been explicitly set.
Instance Method Details
#roxml_attrs ⇒ Object
Returns array of internal reference objects, such as attributes and composed XML objects
546 547 548 549 |
# File 'lib/roxml.rb', line 546 def roxml_attrs @roxml_attrs ||= [] (@roxml_attrs + (superclass.try(:roxml_attrs) || [])).freeze end |
#roxml_namespace ⇒ Object
:nodoc:
540 541 542 |
# File 'lib/roxml.rb', line 540 def roxml_namespace # :nodoc: @roxml_namespace || superclass.try(:roxml_namespace) end |
#roxml_tag_name ⇒ Object
:nodoc:
536 537 538 |
# File 'lib/roxml.rb', line 536 def roxml_tag_name # :nodoc: @roxml_tag_name || superclass.try(:roxml_tag_name) end |
#tag_name ⇒ Object
Returns the tag name (also known as xml_name) of the class. If no tag name is set with xml_name method, returns default class name in lowercase.
If xml_convention is set, it is called with an underscored version of the class name. This is because active support’s inflector generally expects an underscored version, and several operations (e.g. camelcase(:lower), dasherize) do not work without one.
528 529 530 531 532 533 534 |
# File 'lib/roxml.rb', line 528 def tag_name return roxml_tag_name if roxml_tag_name if tag_name = name.split('::').last roxml_naming_convention ? roxml_naming_convention.call(tag_name.underscore) : tag_name.downcase end end |
#tag_refs ⇒ Object
:nodoc:
551 552 553 |
# File 'lib/roxml.rb', line 551 def tag_refs # :nodoc: roxml_attrs.map {|a| a.to_ref(nil) } end |
#xml_construction_args ⇒ Object
:nodoc:
509 510 511 |
# File 'lib/roxml.rb', line 509 def xml_construction_args # :nodoc: @xml_construction_args ||= [] end |
#xml_name? ⇒ Boolean
A helper which enables us to detect when the xml_name has been explicitly set
515 516 517 |
# File 'lib/roxml.rb', line 515 def xml_name? #:nodoc: @roxml_tag_name end |