Module: Cadenza::Library

Included in:
Context, StandardLibrary
Defined in:
lib/cadenza/library.rb,
lib/cadenza/library/blocks.rb,
lib/cadenza/library/filters.rb,
lib/cadenza/library/functions.rb,
lib/cadenza/library/expectation.rb

Defined Under Namespace

Modules: Blocks, Filters, Functions Classes: Expectation

Class Method Summary collapse

Class Method Details

.build(&block) ⇒ Object


9
10
11
# File 'lib/cadenza/library.rb', line 9

def self.build(&block)
   __build(nil, &block)
end

.extended(base) ⇒ Object


13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/cadenza/library.rb', line 13

def self.extended(base)
   base.extend Cadenza::Library::Filters
   base.extend Cadenza::Library::Blocks
   base.extend Cadenza::Library::Functions

   if base.is_a?(Class)
      def base.inherited(base)
         base.filters.merge!(self.filters)
         base.blocks.merge!(self.blocks)
         base.functions.merge!(self.functions)
      end
   else
      def base.enhance(&block)
         Cadenza::Library.send(:__build, self, &block)
      end

      def base.included(library)
         library.filters.merge!(self.filters)
         library.blocks.merge!(self.blocks)
         library.functions.merge!(self.functions)
      end
   end
end