Class: ANN_Report

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

Instance Method Summary collapse

Constructor Details

#initialize(ann_report) ⇒ ANN_Report

initialize and build access methods



5
6
7
8
9
10
11
12
13
# File 'lib/ann_wrapper/ann_report.rb', line 5

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



16
17
18
19
# File 'lib/ann_wrapper/ann_report.rb', line 16

def get_info_on(var_name)
	body = @ann_report.at_xpath(var_name)
	body.content unless body.nil?
end

#to_hHash

Returns hash of self.

Returns:

  • (Hash)

    hash of self



22
23
24
25
# File 'lib/ann_wrapper/ann_report.rb', line 22

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