Module: Covenant
- Defined in:
- lib/covenant.rb,
lib/covenant/version.rb
Defined Under Namespace
Modules: DSL Classes: AssertionFailed, ErrorMessage
Constant Summary collapse
- VERSION =
"0.8.0"
Class Method Summary collapse
-
.abide(base = Object, as = [:assert, :asserting]) ⇒ Object
Adds the Covenant DSL to base.
Class Method Details
.abide(base = Object, as = [:assert, :asserting]) ⇒ Object
Adds the Covenant DSL to base.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/covenant.rb', line 9 def self.abide(base = Object, as = [:assert, :asserting]) target = Class === base ? base : base.singleton_class target.class_eval do include Covenant::DSL case as when Array as.each do |a| alias_method a, :_assert end when Symbol, String alias_method as, :_assert else raise ArgumentError, "cannot register `#{as.inspect}` as method names" end end end |