Class: Apache::MatchableThing
- Inherits:
-
Object
- Object
- Apache::MatchableThing
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
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
#from ⇒ Object
Returns the value of attribute from.
188
189
190
|
# File 'lib/apache/rewrites.rb', line 188
def from
@from
end
|
#to ⇒ Object
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
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
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
213
|
# File 'lib/apache/rewrites.rb', line 213
def stop_if_match?; false; end
|
#tag ⇒ Object
The Apache directive tag for this thing
191
|
# File 'lib/apache/rewrites.rb', line 191
def tag; raise 'Override this method'; end
|
#to_a ⇒ Object
209
210
211
|
# File 'lib/apache/rewrites.rb', line 209
def to_a
[ to_s ]
end
|
#to_s ⇒ Object
205
206
207
|
# File 'lib/apache/rewrites.rb', line 205
def to_s
"#{tag} #{[@from, @to].quoteize.compact.flatten * " "}"
end
|