Skip to content

Commit 2b23122

Browse files
committed
Merge pull request #3 from lbeder/master
Support aasm 4.1 and above
2 parents 984cd51 + 85fc320 commit 2b23122

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

graphviz_aasm.gemspec

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# coding: utf-8
2-
lib = File.expand_path('../lib', __FILE__)
3-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
2+
$:.push File.expand_path('../lib', __FILE__)
43
require 'graphviz_aasm/version'
54

65
Gem::Specification.new do |spec|
@@ -18,12 +17,11 @@ Gem::Specification.new do |spec|
1817
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
1918
spec.require_paths = ["lib"]
2019

21-
spec.add_development_dependency "bundler", "~> 1.6"
22-
spec.add_development_dependency "rake", "~> 10.3"
23-
spec.add_development_dependency "rspec", "~> 2.14"
20+
spec.add_development_dependency "rake"
21+
spec.add_development_dependency "rspec"
2422

25-
spec.add_dependency "aasm", "~> 3.2"
26-
spec.add_dependency "activesupport", "~> 4.1"
27-
spec.add_dependency "railties", "~> 4.1"
28-
spec.add_dependency "ruby-graphviz", "~> 1.0"
23+
spec.add_dependency "aasm", "~> 4.1"
24+
spec.add_dependency "activesupport"
25+
spec.add_dependency "railties"
26+
spec.add_dependency "ruby-graphviz"
2927
end

lib/graphviz_aasm.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@ def self.draw(class_names, options = {})
1919
state.draw(graph)
2020
end
2121

22-
klass.aasm.events.each_value do |event|
22+
klass.aasm.events.each do |event|
2323
event.draw(graph)
2424
end
2525
graph.output
2626
end
2727
end
2828
end
2929

30-
AASM::State.class_eval do
30+
AASM::Core::State.class_eval do
3131
def draw(graph)
3232
node = graph.add_nodes(self.human_name, shape: final? ? "doublecircle" : "ellipse")
3333
graph.add_edge(graph.add_nodes("starting_state", shape: "point"), node) if initial?
3434
end
3535

3636
def initial?
37-
@clazz.aasm.initial_state == self.name
37+
@klass.aasm.initial_state == self.name
3838
end
3939

4040
def final?
41-
!@clazz.aasm.events.any? do |_, event|
41+
!@klass.aasm.events.any? do |event|
4242
event.transitions.any? do |transition|
4343
transition.from == self.name
4444
end
4545
end
4646
end
4747
end
4848

49-
AASM::Event.class_eval do
49+
AASM::Core::Event.class_eval do
5050
def draw(graph)
5151
transitions.each do |transition|
5252
graph.add_edge(transition.from.to_s.capitalize, transition.to.to_s.capitalize)

spec/lib/graphviz_aasm_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
require "spec_helper"
22

33
describe GraphvizAasm do
4-
pending
4+
skip
55
end

0 commit comments

Comments
 (0)