Class: ETL::Parser::XPath::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/etl/parser/sax_parser.rb

Overview

:nodoc

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, attributes = {}) ⇒ Element

Returns a new instance of Element.



200
201
202
203
# File 'lib/etl/parser/sax_parser.rb', line 200

def initialize(name, attributes={})
  @name = name
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



199
200
201
# File 'lib/etl/parser/sax_parser.rb', line 199

def attributes
  @attributes
end

#nameObject (readonly)

Returns the value of attribute name.



198
199
200
# File 'lib/etl/parser/sax_parser.rb', line 198

def name
  @name
end

Instance Method Details

#to_sObject



204
205
206
207
208
209
210
211
212
213
214
# File 'lib/etl/parser/sax_parser.rb', line 204

def to_s
  s = "#{name}"
  if !@attributes.empty?
    attr_str = @attributes.collect do |key,value|
      value = value.source if value.is_a?(Regexp)
      "#{key}=#{value}" 
    end.join(",")
    s << "[" + attr_str + "]"
  end
  s
end