Class: Athena::Formats::XML::ElementSpec

Inherits:
BaseSpec
  • Object
show all
Defined in:
lib/athena/formats/xml.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from BaseSpec

#done, #empty, #inspect_spec

Methods included from Util

#verbose

Constructor Details

#initialize(name, field, config) ⇒ ElementSpec

Returns a new instance of ElementSpec.



228
229
230
231
232
233
234
# File 'lib/athena/formats/xml.rb', line 228

def initialize(name, field, config)
  super()

  @name   = name
  @field  = field
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



225
226
227
# File 'lib/athena/formats/xml.rb', line 225

def config
  @config
end

#fieldObject (readonly)

Returns the value of attribute field.



225
226
227
# File 'lib/athena/formats/xml.rb', line 225

def field
  @field
end

#nameObject (readonly)

Returns the value of attribute name.



225
226
227
# File 'lib/athena/formats/xml.rb', line 225

def name
  @name
end

#recordObject

Returns the value of attribute record.



226
227
228
# File 'lib/athena/formats/xml.rb', line 226

def record
  @record
end

Instance Method Details

#start(context, name, attrs) ⇒ Object



236
237
238
239
240
# File 'lib/athena/formats/xml.rb', line 236

def start(context, name, attrs)
  super

  self.record = Athena::Record[field, config]
end

#text(context, data) ⇒ Object



242
243
244
245
246
# File 'lib/athena/formats/xml.rb', line 242

def text(context, data)
  super

  record.update(name, data)
end