ulg 0.2.2 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/bin/ulg +2 -1
  2. data/lib/ulg.rb +8 -5
  3. metadata +2 -2
data/bin/ulg CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
+ require "getopt/std"
3
4
  require 'ulg'
4
5
 
5
- VERSION = "0.2.2"
6
+ VERSION = "0.2.3"
6
7
 
7
8
  ulg = ULG.new
8
9
  opt = Getopt::Std.getopts("f:o:s:dhv")
data/lib/ulg.rb CHANGED
@@ -1,9 +1,8 @@
1
- require "getopt/std"
2
1
  require "graphviz"
3
2
 
4
3
  class ULG
5
4
 
6
- attr_accessor :destfile, :output
5
+ attr_accessor :destfile, :output, :nodes, :edges, :arrow_regex
7
6
 
8
7
  def initialize
9
8
  @debug = 0
@@ -38,7 +37,7 @@ class ULG
38
37
  @rex << '(?<to_color>\|[^\]\>\)\} ]+)?'
39
38
  @rex << '(?<to_close>[\]\>\)\}]*)'
40
39
 
41
- @arrow_regex = @rex.join('\s*')
40
+ @arrow_regex = @rex.join '\s*'
42
41
  end
43
42
 
44
43
  def debug
@@ -56,6 +55,7 @@ class ULG
56
55
  def draw(files)
57
56
  dputs "Rex: #{@arrow_regex}"
58
57
 
58
+ # Move files parsing out of here
59
59
  files.each do |file|
60
60
  parse file
61
61
  end
@@ -65,6 +65,7 @@ class ULG
65
65
  return
66
66
  end
67
67
 
68
+ # Move this into a generate function?
68
69
  g = GraphViz.new :G, @graphviz_options
69
70
 
70
71
  @edges.keys.each do |from|
@@ -102,6 +103,8 @@ class ULG
102
103
  end
103
104
 
104
105
  def parse(file)
106
+
107
+ # Iterate over array of files if needed
105
108
 
106
109
  puts "Reading #{file}"
107
110
  if @read_files.include? file
@@ -168,7 +171,7 @@ class ULG
168
171
 
169
172
  def add_node(open, label, color, close)
170
173
 
171
- label.lstrip.rstrip!
174
+ label = label.rstrip.lstrip
172
175
  name = label_to_name label
173
176
 
174
177
  if @nodes.has_key? name and not @nodes[name].has_key? 'cleared'
@@ -202,7 +205,7 @@ class ULG
202
205
 
203
206
  def add_edge(from, to, from_arrow, open, label, color, close, to_arrow)
204
207
 
205
- label.lstrip.rstrip!
208
+ label = label.rstrip.lstrip
206
209
 
207
210
  from_name = label_to_name from
208
211
  to_name = label_to_name to
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ulg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-04-02 00:00:00.000000000 Z
12
+ date: 2013-05-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Ultra Light Graphs - Text editor friendly markup language for creating
15
15
  simple graphs.