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",
  ',' => "\u201A"
}

Instance Method Summary collapse

Instance Method Details

#class(&block) ⇒ Object



23
24
25
26
27
28
# File 'lib/yuml.rb', line 23

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



16
17
18
19
20
21
# File 'lib/yuml.rb', line 16

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