Module: YUML

Extended by:
YUML
Included in:
YUML
Defined in:
lib/yuml.rb,
lib/yuml/note.rb,
lib/yuml/class.rb,
lib/yuml/relationship.rb

Overview

A module to create a DSL for yuml.me

Defined Under Namespace

Modules: Note, Relationship Classes: Class

Constant Summary collapse

ESCAPE_CHARACTERS =
{
  '{' => "\u23A8",
  '}' => "\u23AC",
  '<' => "\u3008",
  '>' => "\u3009",
  ',' => "\u201A",
  '#' => "\u0023"
}

Instance Method Summary collapse

Instance Method Details

#attach_note(content, color = nil) ⇒ Object



34
35
36
# File 'lib/yuml.rb', line 34

def attach_note(content, color = nil)
  notes << YUML::Note.create(content, color)
end

#class(&block) ⇒ Object



27
28
29
30
31
32
# File 'lib/yuml.rb', line 27

def class(&block)
  yuml_class = YUML::Class.new
  block.arity < 1 ? yuml_class.instance_eval(&block) : block.call(yuml_class)
  classes << yuml_class
  yuml_class
end

#generate(file: '/tmp/yuml.pdf') {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (YUML)

    the object that the method was called on



20
21
22
23
24
25
# File 'lib/yuml.rb', line 20

def generate(file: '/tmp/yuml.pdf')
  classes.clear
  notes.clear
  yield self
  fetch_uml file
end