Class: Gliffynator::Diagram
- Inherits:
-
Object
- Object
- Gliffynator::Diagram
- Includes:
- DSL
- Defined in:
- lib/gliffynator/diagram.rb
Instance Attribute Summary collapse
-
#diagram ⇒ Object
Returns the value of attribute diagram.
-
#objects ⇒ Object
Returns the value of attribute objects.
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ Diagram
constructor
A new instance of Diagram.
- #render(filename = nil) ⇒ Object
Methods included from DSL
#add_arrow, #get_id_and_increment
Constructor Details
#initialize(options = {}, &block) ⇒ Diagram
Returns a new instance of Diagram.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/gliffynator/diagram.rb', line 10 def initialize(={}, &block) @objects = Gliffynator::Objects.new @diagram = { contentType: "application/gliffy+json", version: "1.3", stage: { background: "#ffffff", width: 1248, height: 1450, nodeIndex: 1661, autoFit: true, exportBorder: false, gridOn: false, snapToGrid: false, drawingGuidesOn: false, pageBreaksOn: false, printGridOn: false, printPaper: "LETTER", maxWidth: 5000, maxHeight: 5000, themeData: nil, viewportType: "default", fitBB: { min: { x: 15, y: 14 }, max: { x: 1247.5, y: 1450 } }, printModel: { pageSize: "a4", portrait: false, fitToOnePage: true, displayPageBreaks: false }, objects: @objects, layers: [ { guid: "C3WysuhtocNA", order: 0, name: "Layer 0", active: true, locked: false, visible: true, nodeIndex: 185 } ], shapeStyles: {}, lineStyles: {}, textStyles: { global: { bold: false, underline: false } } }, metadata: { title: "untitled", revision: 0, exportBorder: false, loadPosition: "default", libraries: [ "com.gliffy.libraries.uml.uml_v1.default", "com.gliffy.libraries.erd.erd_v1.default", "com.gliffy.libraries.basic.basic_v1.default", "com.gliffy.libraries.images" ], lastSerialized: DateTime.now.strftime("%Q"), analyticsProduct: "Confluence" }, embeddedResources: { index: 0, resources: [] } }.merge self.instance_eval(&block) if block self end |
Instance Attribute Details
#diagram ⇒ Object
Returns the value of attribute diagram.
7 8 9 |
# File 'lib/gliffynator/diagram.rb', line 7 def diagram @diagram end |
#objects ⇒ Object
Returns the value of attribute objects.
8 9 10 |
# File 'lib/gliffynator/diagram.rb', line 8 def objects @objects end |
Instance Method Details
#render(filename = nil) ⇒ Object
96 97 98 99 100 101 102 |
# File 'lib/gliffynator/diagram.rb', line 96 def render( filename=nil ) if filename return File.write(filename, @diagram.to_json) end @diagram.to_json end |