Class: ANN_Report

Inherits:
ANN
  • Object
show all
Defined in:
lib/ann_wrapper/ann_objects.rb

Instance Method Summary collapse

Constructor Details

#initialize(ann_report) ⇒ ANN_Report

initialize and build access methods



193
194
195
196
197
198
199
200
201
# File 'lib/ann_wrapper/ann_objects.rb', line 193

def initialize(ann_report)
  @id, @type, @name, @precision, @vintage = ""
  @ann_report = ann_report

  self.instance_variables.each do |iv|
    var_name = iv[1..-1]
    create_method(var_name) { get_info_on(var_name) }
  end
end

Instance Method Details

#get_info_on(var_name) ⇒ Object

get info from xml



204
205
206
207
208
209
210
# File 'lib/ann_wrapper/ann_objects.rb', line 204

def get_info_on(var_name)
  begin 
    @ann_report.at_xpath(var_name).content
  rescue NameError
    nil
  end
end

#to_hHash

Returns hash of self.

Returns:

  • (Hash)

    hash of self



213
214
215
216
# File 'lib/ann_wrapper/ann_objects.rb', line 213

def to_h
  # create hash excluding some methods
  to_hash([:to_h, :ann_report, :get_info_on])
end