Class: Ox::Mapper::Element Private

Inherits:
Object
  • Object
show all
Defined in:
lib/ox/mapper/element.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

An element representing XML-node

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, line = nil, column = nil) ⇒ Element

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize element with name

Parameters:

  • name (Symbol)
  • line (Integer) (defaults to: nil)
  • column (Integer) (defaults to: nil)


17
18
19
# File 'lib/ox/mapper/element.rb', line 17

def initialize(name, line = nil, column = nil)
  @name, @line, @column = name, line, column
end

Instance Attribute Details

#attributesHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get attributes hash

Returns:

  • (Hash)

    attributes



40
41
42
# File 'lib/ox/mapper/element.rb', line 40

def attributes
  @attributes ||= {}
end

#columnObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/ox/mapper/element.rb', line 9

def column
  @column
end

#lineObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/ox/mapper/element.rb', line 9

def line
  @line
end

#nameObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/ox/mapper/element.rb', line 9

def name
  @name
end

#parentObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/ox/mapper/element.rb', line 9

def parent
  @parent
end

#textObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



9
10
11
# File 'lib/ox/mapper/element.rb', line 9

def text
  @text
end

Instance Method Details

#[](name) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Get attribute value

Parameters:

  • name (Symbol, String)

    attribute name

Returns:

  • (Object)

    attribute value



33
34
35
# File 'lib/ox/mapper/element.rb', line 33

def [](name)
  @attributes && @attributes[name.to_sym]
end

#[]=(name, value) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Set element attribute

Parameters:

  • name (Symbol, String)

    attribute name

  • value (Object)

    attribute value



25
26
27
# File 'lib/ox/mapper/element.rb', line 25

def []=(name, value)
  attributes[name] = value
end