Class: Obp::Access::Parser
- Inherits:
-
Object
- Object
- Obp::Access::Parser
- Defined in:
- lib/obp/access/parser.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
readonly
Returns the value of attribute directory.
-
#urn ⇒ Object
readonly
Returns the value of attribute urn.
Instance Method Summary collapse
- #available_languages ⇒ Object
- #html ⇒ Object
-
#initialize(urn:, directory:) ⇒ Parser
constructor
A new instance of Parser.
- #title ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(urn:, directory:) ⇒ Parser
Returns a new instance of Parser.
6 7 8 9 |
# File 'lib/obp/access/parser.rb', line 6 def initialize(urn:, directory:) @urn = urn @directory = directory end |
Instance Attribute Details
#directory ⇒ Object (readonly)
Returns the value of attribute directory.
4 5 6 |
# File 'lib/obp/access/parser.rb', line 4 def directory @directory end |
#urn ⇒ Object (readonly)
Returns the value of attribute urn.
4 5 6 |
# File 'lib/obp/access/parser.rb', line 4 def urn @urn end |
Instance Method Details
#available_languages ⇒ Object
28 29 30 31 32 33 |
# File 'lib/obp/access/parser.rb', line 28 def available_languages state .select { |attr| !attr["caption"]&.empty? && attr["styles"]&.include?("toggle") } .filter_map { |attr| attr["caption"] } .uniq end |
#html ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/obp/access/parser.rb', line 19 def html @html ||= begin content = state.filter_map { |attr| attr["htmlContent"] }.first raise "OBP content not found for URN #{urn}" unless content content end end |
#title ⇒ Object
15 16 17 |
# File 'lib/obp/access/parser.rb', line 15 def title tab_data["description"] end |
#to_xml ⇒ Object
11 12 13 |
# File 'lib/obp/access/parser.rb', line 11 def to_xml xml end |