basic_decorator 0.1.0 → 0.2.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/.travis.yml +9 -0
- data/README.md +8 -2
- data/lib/basic_decorator/decorator.rb +4 -0
- data/lib/basic_decorator/version.rb +1 -1
- data/spec/lib/basic_decorator/decorator_spec.rb +2 -2
- metadata +3 -2
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# BasicDecorator
|
2
2
|
|
3
|
+
[](http://travis-ci.org/joshuaclayton/basic_decorator)
|
4
|
+
[Generated documentation on Rubydoc.info](http://rubydoc.info/github/joshuaclayton/basic_decorator)
|
5
|
+
|
3
6
|
Decoration in Ruby should be easy. With `BasicDecorator`, it is.
|
4
7
|
|
5
8
|
`BasicDecorator` was spawned by my [Gist](https://gist.github.com/1523849) in
|
@@ -8,6 +11,9 @@ blog](http://robots.thoughtbot.com/post/14825364877/evaluating-alternative-decor
|
|
8
11
|
|
9
12
|
## Installation
|
10
13
|
|
14
|
+
Make sure you're running Ruby 1.9 (`BasicDecorator::Decorator`, the meat and
|
15
|
+
potatoes of the gem, inherits from Ruby's `BasicObject`, which is 1.9+).
|
16
|
+
|
11
17
|
Add this line to your application's Gemfile:
|
12
18
|
|
13
19
|
gem 'basic_decorator'
|
@@ -61,7 +67,7 @@ Fairly straightforward. Let's write up decorators for `Cream` and `Sugar`.
|
|
61
67
|
```ruby
|
62
68
|
class Cream < BasicDecorator::Decorator
|
63
69
|
def cost
|
64
|
-
@component.cost +
|
70
|
+
@component.cost + Money.new(75, 'USD')
|
65
71
|
end
|
66
72
|
|
67
73
|
def additional_ingredients
|
@@ -71,7 +77,7 @@ end
|
|
71
77
|
|
72
78
|
class Sugar < BasicDecorator::Decorator
|
73
79
|
def cost
|
74
|
-
@component.cost +
|
80
|
+
@component.cost + Money.new(25, 'USD')
|
75
81
|
end
|
76
82
|
|
77
83
|
def additional_ingredients
|
@@ -19,7 +19,7 @@ describe BasicDecorator::Decorator do
|
|
19
19
|
|
20
20
|
class Cream < BasicDecorator::Decorator
|
21
21
|
def cost
|
22
|
-
@component.cost +
|
22
|
+
@component.cost + Money.new(75, 'USD')
|
23
23
|
end
|
24
24
|
|
25
25
|
def additional_ingredients
|
@@ -29,7 +29,7 @@ describe BasicDecorator::Decorator do
|
|
29
29
|
|
30
30
|
class Sugar < BasicDecorator::Decorator
|
31
31
|
def cost
|
32
|
-
@component.cost +
|
32
|
+
@component.cost + Money.new(25, 'USD')
|
33
33
|
end
|
34
34
|
|
35
35
|
def additional_ingredients
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: basic_decorator
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
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: 2012-
|
12
|
+
date: 2012-06-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -51,6 +51,7 @@ extensions: []
|
|
51
51
|
extra_rdoc_files: []
|
52
52
|
files:
|
53
53
|
- .gitignore
|
54
|
+
- .travis.yml
|
54
55
|
- Gemfile
|
55
56
|
- LICENSE
|
56
57
|
- README.md
|