Module: H2o::Filters

Defined in:
lib/h2o/filters.rb

Defined Under Namespace

Classes: Base

Class Method Summary collapse

Class Method Details

.<<(filter) ⇒ Object



18
19
20
# File 'lib/h2o/filters.rb', line 18

def << (filter)
  @filters << filter
end

.[](name) ⇒ Object



14
15
16
# File 'lib/h2o/filters.rb', line 14

def [] name
  @filters[name]
end

.allObject



42
43
44
# File 'lib/h2o/filters.rb', line 42

def all
  @filters
end

.build(context) ⇒ Object



26
27
28
29
30
31
32
33
34
# File 'lib/h2o/filters.rb', line 26

def build(context)
  @base = Base.new(context)

  @filters.each do |filter|
    @base.extend(filter)
  end

  @base
end

.create(name, &block) ⇒ Object



36
37
38
39
40
# File 'lib/h2o/filters.rb', line 36

def create name, &block
  Base.class_eval do
    define_method name, &block
  end
end

.register(filter) ⇒ Object



22
23
24
# File 'lib/h2o/filters.rb', line 22

def register filter
  @filters << filter
end