Class: Opener::KafToJson
- Inherits:
-
Object
- Object
- Opener::KafToJson
- Defined in:
- lib/opener/kaf_to_json.rb,
lib/opener/kaf_to_json/cli.rb,
lib/opener/kaf_to_json/server.rb,
lib/opener/kaf_to_json/version.rb
Overview
Component for converting KAF documents to JSON objects.
Defined Under Namespace
Constant Summary collapse
- VERSION =
'2.0.1'
Instance Method Summary collapse
-
#initialize ⇒ KafToJson
constructor
This method takes a single argument that is ignored to ensure compatibility with all the other OpeNER components.
-
#output_type ⇒ Symbol
The output type to use in the webservices.
-
#run(input) ⇒ String
(also: #tag)
Processes the input KAF document and returns a String containing the JSON output.
Constructor Details
#initialize ⇒ KafToJson
This method takes a single argument that is ignored to ensure compatibility with all the other OpeNER components.
18 |
# File 'lib/opener/kaf_to_json.rb', line 18 def initialize(*); end |
Instance Method Details
#output_type ⇒ Symbol
The output type to use in the webservices.
46 47 48 |
# File 'lib/opener/kaf_to_json.rb', line 46 def output_type return :json end |
#run(input) ⇒ String Also known as: tag
Processes the input KAF document and returns a String containing the JSON output.
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/opener/kaf_to_json.rb', line 27 def run(input) encoded = Rumoji.encode(input) doc = Saxon::XML(encoded) xslt = Saxon::XSLT(File.read(xsl)) decoded = Rumoji.decode(xslt.transform(doc).to_s) return decoded end |