Module: YUML

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

Overview

A module to create a DSL for yuml.me

Defined Under Namespace

Modules: Relationship Classes: Class

Constant Summary collapse

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

Instance Method Summary collapse

Instance Method Details

#attach_note(content, options = {}) ⇒ Object



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

def attach_note(content, options = {})
  notes << YUML::Note.create(content, options)
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(options) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (YUML)

    the object that the method was called on



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

def generate(options)
  options = { file: '/tmp/yuml.pdf' }.merge(options)
  classes.clear
  notes.clear
  yield self
  fetch_uml options[:file]
end