Class: OpenBD::Contents

Inherits:
Object
  • Object
show all
Defined in:
lib/open_bd/contents.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ Contents

Returns a new instance of Contents.



5
6
7
# File 'lib/open_bd/contents.rb', line 5

def initialize(source)
  @source = source
end

Instance Attribute Details

#sourceObject (readonly)

Returns the value of attribute source.



3
4
5
# File 'lib/open_bd/contents.rb', line 3

def source
  @source
end

Instance Method Details

#contentsObject



9
10
11
12
13
14
# File 'lib/open_bd/contents.rb', line 9

def contents
  value = source.find { |x| x["TextType"] == "02" }
  if !value.nil?
    value["Text"]
  end
end

#contents_detailObject



16
17
18
19
20
21
# File 'lib/open_bd/contents.rb', line 16

def contents_detail
  value = source.find { |x| x["TextType"] == "03" }
  if !value.nil?
    value["Text"]
  end
end

#table_of_contentsObject



23
24
25
26
27
28
# File 'lib/open_bd/contents.rb', line 23

def table_of_contents
  value = source.find { |x| x["TextType"] == "04" }
  if !value.nil?
    value["Text"]
  end
end