Class: Apache::MatchableThing

Inherits:
Object
  • Object
show all
Defined in:
lib/apache/rewrites.rb

Overview

A matchable thing to be extended

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMatchableThing

Returns a new instance of MatchableThing.



193
194
195
196
# File 'lib/apache/rewrites.rb', line 193

def initialize
  @from = nil
  @to = nil
end

Instance Attribute Details

#fromObject (readonly)

Returns the value of attribute from.



188
189
190
# File 'lib/apache/rewrites.rb', line 188

def from
  @from
end

#toObject (readonly)

Returns the value of attribute to.



188
189
190
# File 'lib/apache/rewrites.rb', line 188

def to
  @to
end

Instance Method Details

#forbidden?Boolean

Returns:

  • (Boolean)


214
# File 'lib/apache/rewrites.rb', line 214

def forbidden?; false; end

#from_tester(from, opts) ⇒ Object



217
218
219
220
221
222
# File 'lib/apache/rewrites.rb', line 217

def from_tester(from, opts)
  from = test(from, opts)
  from = @from if (@to == '-')
  from = :http_forbidden if (forbidden?)
  from
end

#require_regexp?Boolean

Returns:

  • (Boolean)


215
# File 'lib/apache/rewrites.rb', line 215

def require_regexp?; false; end

#rule(from, to) ⇒ Object



198
199
200
201
202
203
# File 'lib/apache/rewrites.rb', line 198

def rule(from, to)
  raise "from must be a Regexp" if (!from.kind_of?(Regexp) && require_regexp?)

  @from = from
  @to = to
end

#stop_if_match?Boolean

Returns:

  • (Boolean)


213
# File 'lib/apache/rewrites.rb', line 213

def stop_if_match?; false; end

#tagObject

The Apache directive tag for this thing



191
# File 'lib/apache/rewrites.rb', line 191

def tag; raise 'Override this method'; end

#to_aObject



209
210
211
# File 'lib/apache/rewrites.rb', line 209

def to_a
  [ to_s ]
end

#to_sObject



205
206
207
# File 'lib/apache/rewrites.rb', line 205

def to_s
  "#{tag} #{[@from, @to].quoteize.compact.flatten * " "}"
end