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.



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

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

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

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



234
235
236
# File 'lib/athena/formats/xml.rb', line 234

def config
  @config
end

#fieldObject (readonly)

Returns the value of attribute field.



234
235
236
# File 'lib/athena/formats/xml.rb', line 234

def field
  @field
end

#nameObject (readonly)

Returns the value of attribute name.



234
235
236
# File 'lib/athena/formats/xml.rb', line 234

def name
  @name
end

#recordObject

Returns the value of attribute record.



235
236
237
# File 'lib/athena/formats/xml.rb', line 235

def record
  @record
end

Instance Method Details

#start(context, name, attrs) ⇒ Object



245
246
247
248
249
# File 'lib/athena/formats/xml.rb', line 245

def start(context, name, attrs)
  super

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

#text(context, data) ⇒ Object



251
252
253
254
255
# File 'lib/athena/formats/xml.rb', line 251

def text(context, data)
  super

  record.update(name, data)
end