basic_decorator 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,9 @@
1
+ rvm:
2
+ - 1.9.2
3
+ - 1.9.3
4
+ before_install:
5
+ - gem update --system
6
+ script: "rake"
7
+ branches:
8
+ only:
9
+ - master
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # BasicDecorator
2
2
 
3
+ [![Build Status](https://secure.travis-ci.org/joshuaclayton/basic_decorator.png?branch=master)](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 + ::Money.new(75, 'USD')
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 + ::Money.new(25, 'USD')
80
+ @component.cost + Money.new(25, 'USD')
75
81
  end
76
82
 
77
83
  def additional_ingredients
@@ -13,5 +13,9 @@ module BasicDecorator
13
13
  def send(symbol, *args)
14
14
  __send__(symbol, *args)
15
15
  end
16
+
17
+ def self.const_missing(name)
18
+ ::Object.const_get name
19
+ end
16
20
  end
17
21
  end
@@ -1,3 +1,3 @@
1
1
  module BasicDecorator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -19,7 +19,7 @@ describe BasicDecorator::Decorator do
19
19
 
20
20
  class Cream < BasicDecorator::Decorator
21
21
  def cost
22
- @component.cost + ::Money.new(75, 'USD')
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 + ::Money.new(25, 'USD')
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.1.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-05-11 00:00:00.000000000 Z
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