Class: Ocelot::ScriptFilter
Instance Method Summary
collapse
#filter
Methods inherited from Base
#connection, #in?, #logger, #obj_to_s, #remove_callbacks, #safely
Constructor Details
Returns a new instance of ScriptFilter.
106
107
108
|
# File 'lib/ocelot/dsl.rb', line 106
def initialize(p)
@p = p
end
|
Instance Method Details
#default ⇒ Object
126
127
128
|
# File 'lib/ocelot/dsl.rb', line 126
def default
@result = old_load @obj, @collection, @name
end
|
#load(obj, collection, name) ⇒ Object
110
111
112
113
114
115
116
|
# File 'lib/ocelot/dsl.rb', line 110
def load(obj, collection, name)
@obj, @collection, @name = obj, collection, name
@result = nil
instance_exec(obj, collection, name, &@p)
@result || default
end
|
#nothing ⇒ Object
118
119
120
|
# File 'lib/ocelot/dsl.rb', line 118
def nothing
@result = []
end
|
#old_load ⇒ Object
105
|
# File 'lib/ocelot/dsl.rb', line 105
alias :old_load :load
|
#result(val) ⇒ Object
122
123
124
|
# File 'lib/ocelot/dsl.rb', line 122
def result(val)
@result = val
end
|