hero 0.0.9 → 0.1.0
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.
- data/README.md +1 -1
- data/lib/hero/formula.rb +4 -3
- data/spec/formula_spec.rb +4 -4
- metadata +5 -4
data/README.md
CHANGED
@@ -26,7 +26,7 @@ One that evolved from the real world with concrete use cases and actual producti
|
|
26
26
|
* It easily handles changing requirements
|
27
27
|
* It reduces the ramp up time for new team members
|
28
28
|
|
29
|
-
## Process
|
29
|
+
## Match the Implementation to the Business Process
|
30
30
|
|
31
31
|
The problem has always been: **How do you effectively model a business process within your app?**
|
32
32
|
|
data/lib/hero/formula.rb
CHANGED
@@ -65,11 +65,12 @@ module Hero
|
|
65
65
|
def register(name)
|
66
66
|
observer = Hero::Observer.new(name)
|
67
67
|
formula_class_name = name.to_s.strip.gsub(/\s/, "_").gsub(/[^a-z_]/i, "").split(/_/).map(&:capitalize).join
|
68
|
+
formula_class_name = "HeroFormula#{formula_class_name}"
|
68
69
|
formula_class = Class.new(Hero::Formula)
|
69
|
-
if
|
70
|
-
|
70
|
+
if Object.const_defined?(formula_class_name)
|
71
|
+
Object.send(:remove_const, formula_class_name)
|
71
72
|
end
|
72
|
-
|
73
|
+
Object.const_set(formula_class_name, formula_class)
|
73
74
|
formula = formula_class.instance
|
74
75
|
formula.add_observer(observer)
|
75
76
|
formula.instance_eval do
|
data/spec/formula_spec.rb
CHANGED
@@ -10,14 +10,14 @@ describe Hero::Formula do
|
|
10
10
|
|
11
11
|
it "should create a named class" do
|
12
12
|
Hero::Formula[:my_formula]
|
13
|
-
assert
|
14
|
-
assert_equal Hero::Formula[:my_formula].class.name, "
|
15
|
-
assert Hero::Formula[:my_formula].is_a?
|
13
|
+
assert Object.const_defined?("HeroFormulaMyFormula")
|
14
|
+
assert_equal Hero::Formula[:my_formula].class.name, "HeroFormulaMyFormula"
|
15
|
+
assert Hero::Formula[:my_formula].is_a? HeroFormulaMyFormula
|
16
16
|
end
|
17
17
|
|
18
18
|
it "should safely create a named class" do
|
19
19
|
Hero::Formula["A long and cr@zy f0rmul@ name ~12$%"]
|
20
|
-
assert Hero::Formula.const_defined?("
|
20
|
+
assert Hero::Formula.const_defined?("HeroFormulaALongAndCrzyFrmulName")
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should support reset" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,9 +9,10 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-03 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
|
-
description: ! ' Simplify your
|
14
|
+
description: ! ' Simplify your app by effectively modeling business processes within
|
15
|
+
it.
|
15
16
|
|
16
17
|
'
|
17
18
|
email:
|
@@ -53,6 +54,6 @@ rubyforge_project:
|
|
53
54
|
rubygems_version: 1.8.24
|
54
55
|
signing_key:
|
55
56
|
specification_version: 3
|
56
|
-
summary:
|
57
|
+
summary: Hero saves the day by aligning your implementation to business processes.
|
57
58
|
test_files: []
|
58
59
|
has_rdoc:
|