Module: DotR::Styled

Included in:
Connection, Digraph, Node
Defined in:
lib/dotr.rb

Overview

:nodoc:

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



3
4
5
6
# File 'lib/dotr.rb', line 3

def method_missing(method, *args)
  return super unless /^(\w+)=$/ =~ method.to_s && args.size == 1
  style_attrs()[$1.to_sym] = args.first
end

Instance Method Details

#styleObject



8
9
10
11
# File 'lib/dotr.rb', line 8

def style
  return '' if style_attrs.empty?
  " [" + style_attrs.keys.sort_by { |k| k.to_s }.map { |k| "#{k}=\"#{style_attrs[k]}\"" }.join(',') + "]"
end