Skip to content

Commit

Permalink
Find constants correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaclayton committed Jun 11, 2012
1 parent 2539f8b commit 770aa39
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -67,7 +67,7 @@ Fairly straightforward. Let's write up decorators for `Cream` and `Sugar`.
```ruby ```ruby
class Cream < BasicDecorator::Decorator class Cream < BasicDecorator::Decorator
def cost def cost
@component.cost + ::Money.new(75, 'USD') @component.cost + Money.new(75, 'USD')
end end


def additional_ingredients def additional_ingredients
Expand All @@ -77,7 +77,7 @@ end


class Sugar < BasicDecorator::Decorator class Sugar < BasicDecorator::Decorator
def cost def cost
@component.cost + ::Money.new(25, 'USD') @component.cost + Money.new(25, 'USD')
end end


def additional_ingredients def additional_ingredients
Expand Down
4 changes: 4 additions & 0 deletions lib/basic_decorator/decorator.rb
Expand Up @@ -13,5 +13,9 @@ def method_missing(name, *args, &block)
def send(symbol, *args) def send(symbol, *args)
__send__(symbol, *args) __send__(symbol, *args)
end end

def self.const_missing(name)
::Object.const_get name
end
end end
end end
4 changes: 2 additions & 2 deletions spec/lib/basic_decorator/decorator_spec.rb
Expand Up @@ -19,7 +19,7 @@ def additional_ingredients


class Cream < BasicDecorator::Decorator class Cream < BasicDecorator::Decorator
def cost def cost
@component.cost + ::Money.new(75, 'USD') @component.cost + Money.new(75, 'USD')
end end


def additional_ingredients def additional_ingredients
Expand All @@ -29,7 +29,7 @@ def additional_ingredients


class Sugar < BasicDecorator::Decorator class Sugar < BasicDecorator::Decorator
def cost def cost
@component.cost + ::Money.new(25, 'USD') @component.cost + Money.new(25, 'USD')
end end


def additional_ingredients def additional_ingredients
Expand Down

0 comments on commit 770aa39

Please sign in to comment.