Sha256: 23082dedf3dbb2a26897ab8dd3105237a19016864eb506381c1e86c32778eb3d

Contents?: true

Size: 828 Bytes

Versions: 2

Compression:

Stored size: 828 Bytes

Contents

class Tarquinn::Config
  attr_accessor :redirect

  def initialize(redirect)
    @redirect = redirect
  end

  def add_skip_action(*routes)
    skip_blocks << block_routes(routes)
  end

  def add_redirection_rules(*methods, &block)
    redirection_blocks << block_methods(methods)
    redirection_blocks << Tarquinn::Condition::ProcRunner.new(&block) if block_given?
  end

  def add_skip_rules(*methods, &block)
    skip_blocks << block_methods(methods)
    skip_blocks << Tarquinn::Condition::ProcRunner.new(&block) if block_given?
  end

  def redirection_blocks
    @blocks ||= []
  end

  def skip_blocks
    @skip_blocks ||= []
  end

  private

  def block_methods(methods)
    Tarquinn::Condition::MethodCaller.new(methods)
  end

  def block_routes(routes)
    Tarquinn::Condition::ActionChecker.new(routes)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tarquinn-0.2.0 lib/tarquinn/config.rb
tarquinn-0.1.0 lib/tarquinn/config.rb