Class: Mabmapper::MabXml::Query

Inherits:
Object
  • Object
show all
Includes:
QueryHelper
Defined in:
lib/mabmapper/mab_xml/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from QueryHelper

#field, #get, #subfield

Constructor Details

#initialize(xml) ⇒ Query

Returns a new instance of Query.



8
9
10
11
12
# File 'lib/mabmapper/mab_xml/query.rb', line 8

def initialize(xml)
  @xml       = xml
  @fields    = []
  @subfields = []
end

Instance Attribute Details

#fieldsObject (readonly)

Returns the value of attribute fields.



6
7
8
# File 'lib/mabmapper/mab_xml/query.rb', line 6

def fields
  @fields
end

#subfieldsObject (readonly)

Returns the value of attribute subfields.



6
7
8
# File 'lib/mabmapper/mab_xml/query.rb', line 6

def subfields
  @subfields
end

#xmlObject (readonly)

Returns the value of attribute xml.



6
7
8
# File 'lib/mabmapper/mab_xml/query.rb', line 6

def xml
  @xml
end

Instance Method Details

#add_field(name, options = {}) ⇒ Object



14
15
16
17
# File 'lib/mabmapper/mab_xml/query.rb', line 14

def add_field(name, options={})
  @fields << {name: name, options: options.reverse_merge(ind1: nil, ind2: nil)}
  self
end

#add_subfield(name) ⇒ Object



19
20
21
22
# File 'lib/mabmapper/mab_xml/query.rb', line 19

def add_subfield(name)
  @subfields << {name: name}
  self
end