Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'rubygems'
- require 'active_support'
- class Base
- class_inheritable_accessor :name
- self.name = "Base"
- end
- class Foo < Base
- self.name = "Foo"
- end
- f = Foo.new
- puts f.name
- b = Base.new
- puts b.name
- # Foo
- # Foo
- module Scenarios
- class ScenarioError < StandardError
- class_inheritable_accessor :messages
- self.messages = {
- :foo => lambda { "bar" }
- }
- def initialize(message_key, *args)
- super(messages[message_key].call(*args))
- end
- end
- class FooError < ScenarioError
- self.messages.merge!({:bar => lambda { "foo"}})
- end
- end
- #raise Scenarios::FooError.new(:bar)
- p Scenarios::FooError.messages.inspect
- raise Scenarios::FooError.new(:foo)
Add Comment
Please, Sign In to add comment