class Sheng::Filters::Base

Attributes

arguments[R]
method[R]
value[R]

Public Class Methods

implements(*names) click to toggle source
# File lib/sheng/filters/base.rb, line 11
def self.implements(*names)
  names.each do |name|
    Sheng::Filters.registry.merge!({ name.to_sym => self })
  end
end
new(method: method, arguments: []) click to toggle source
# File lib/sheng/filters/base.rb, line 6
def initialize(method: method, arguments: [])
  @method = method
  @arguments = arguments
end

Public Instance Methods

filter(value) click to toggle source
# File lib/sheng/filters/base.rb, line 17
def filter(value)
  return value unless value.respond_to?(method)
  value.send(method, *arguments)
end