Class: GraphdocRuby::Graphdoc
- Inherits:
-
Object
- Object
- GraphdocRuby::Graphdoc
- Defined in:
- lib/graphdoc-ruby/graphdoc.rb
Instance Method Summary collapse
- #generate_document! ⇒ Object
-
#initialize(output:, endpoint:, overwrite:, executable:, mtime:, query: {}, context: {}) ⇒ Graphdoc
constructor
A new instance of Graphdoc.
Constructor Details
#initialize(output:, endpoint:, overwrite:, executable:, mtime:, query: {}, context: {}) ⇒ Graphdoc
Returns a new instance of Graphdoc.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/graphdoc-ruby/graphdoc.rb', line 6 def initialize(output:, endpoint:, overwrite:, executable:, mtime:, query: {}, context: {}) @endpoint = endpoint @executable = executable @overwrite = overwrite @mtime = mtime @output_html = File.join(output, 'index.html') @options = ['--output', output] @options += ['--force'] if overwrite if query && !query.empty? query.each do |key_value| @options += ['--query', key_value.join('=')] end end if context && !context.empty? context.each do |key_value| @options += ['--header', key_value.join(': ')] end end end |
Instance Method Details
#generate_document! ⇒ Object
29 30 31 32 33 34 |
# File 'lib/graphdoc-ruby/graphdoc.rb', line 29 def generate_document! return if generated? , status = Open3.capture2e(*command) raise "Command failed. (#{command}) '#{}'" unless status.success? end |