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

Constructor Details

#initialize(name, field, config) ⇒ ElementSpec

Returns a new instance of ElementSpec.



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

def initialize(name, field, config)
  super()
  @name, @field, @config = name, field, config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



231
232
233
# File 'lib/athena/formats/xml.rb', line 231

def config
  @config
end

#fieldObject (readonly)

Returns the value of attribute field.



231
232
233
# File 'lib/athena/formats/xml.rb', line 231

def field
  @field
end

#nameObject (readonly)

Returns the value of attribute name.



231
232
233
# File 'lib/athena/formats/xml.rb', line 231

def name
  @name
end

#recordObject

Returns the value of attribute record.



232
233
234
# File 'lib/athena/formats/xml.rb', line 232

def record
  @record
end

Instance Method Details

#start(context, name, attrs) ⇒ Object



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

def start(context, name, attrs)
  context = super
  self.record = Athena::Record[field, config]
  context
end

#text(context, data) ⇒ Object



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

def text(context, data)
  context = super
  record.update(name, data)
  context
end