Module: Qippet

Extended by:
Config
Defined in:
lib/qippet.rb,
lib/qippet/colors.rb,
lib/qippet/config.rb,
lib/qippet/builder.rb,
lib/qippet/extract.rb,
lib/qippet/version.rb,
lib/qippet/boxes/box.rb,
lib/qippet/builder/xml.rb,
lib/qippet/boxes/code_box.rb,
lib/qippet/boxes/text_box.rb,
lib/qippet/boxes/container_box.rb

Overview

Qippet

Defined Under Namespace

Modules: Boxes, Builder, Colors, Config Classes: Error, Extract

Constant Summary collapse

VERSION =
"0.1.3"

Class Method Summary collapse

Methods included from Config

config, configure

Class Method Details

.generate(layout_path = nil, output_path = "output.png") {|config| ... } ⇒ Object

Yields:



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/qippet.rb', line 14

def generate(layout_path = nil, output_path = "output.png")
  yield config if block_given?

  extracted = Extract.from_file(layout_path)
  node = Builder.build(extracted)

  if node.nil?
    puts "File does not contain a valid Qippet structure"
    return nil
  end

  result = node&.render
  result.write(output_path)
  output_path
end