Class: DiviningRod::Profile
- Inherits:
-
Object
- Object
- DiviningRod::Profile
show all
- Defined in:
- lib/divining_rod/profile.rb
Instance Method Summary
collapse
Constructor Details
#initialize(request) ⇒ Profile
Returns a new instance of Profile.
4
5
6
|
# File 'lib/divining_rod/profile.rb', line 4
def initialize(request)
@request = request.clone end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/divining_rod/profile.rb', line 24
def method_missing(meth)
if meth.to_s.match(/(.+)\?$/)
tag = $1
if match
match.tags.include?(tag.to_s) || match.tags.include?(tag.to_sym) || match.tags == tag
else
false
end
elsif match.opts.include?(meth.to_sym)
match.opts[meth]
else
super
end
end
|
Instance Method Details
12
13
14
15
16
17
18
|
# File 'lib/divining_rod/profile.rb', line 12
def format
if match && match.format
match.format
else
@request.format
end
end
|