module Amakanize::Filterable

Public Class Methods

included(base) click to toggle source
# File lib/amakanize/filterable.rb, line 3
def self.included(base)
  base.extend(ClassMethods)
end
new(raw) click to toggle source

@param raw [String]

# File lib/amakanize/filterable.rb, line 8
def initialize(raw)
  @raw = raw
end

Public Instance Methods

to_s() click to toggle source

@note Override

# File lib/amakanize/filterable.rb, line 13
def to_s
  filters.inject(context: {}, output: raw) do |result, filter|
    filter.call(result)
  end[:output]
end

Private Instance Methods

filters() click to toggle source

@private @return [Array<Amakanize::Filters::BaseFilter>]

# File lib/amakanize/filterable.rb, line 23
def filters
  @filters ||= self.class.filter_classes.map(&:new)
end
raw() click to toggle source

@private @return [String]

# File lib/amakanize/filterable.rb, line 29
def raw
  @raw
end