Class: SBSM::LookandfeelWrapper
Constant Summary
Constants inherited
from Lookandfeel
SBSM::Lookandfeel::DICTIONARIES, SBSM::Lookandfeel::DISABLED, SBSM::Lookandfeel::ENABLED, SBSM::Lookandfeel::HTML_ATTRIBUTES, SBSM::Lookandfeel::RESOURCES, SBSM::Lookandfeel::RESOURCE_BASE, SBSM::Lookandfeel::TXT_RESOURCES
Instance Attribute Summary
Attributes inherited from Lookandfeel
#flavor, #language, #session
Instance Method Summary
collapse
Methods inherited from Lookandfeel
#_event_url, #_lookup, #base_url, #direct_event, #event_url, #format_date, #format_price, #format_time, #language_url, #resource_external, #resource_localized, txt_file
Constructor Details
Returns a new instance of LookandfeelWrapper.
30
31
32
33
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 30
def initialize(component)
@component = component
super(@component.session)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(symbol, *args, &block) ⇒ Object
34
35
36
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 34
def method_missing(symbol, *args, &block)
@component.send(symbol, *args, &block)
end
|
Instance Method Details
#attributes(key) ⇒ Object
37
38
39
40
41
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 37
def attributes(key)
self::class::HTML_ATTRIBUTES.fetch(key.to_sym) {
@component.attributes(key)
}
end
|
#disabled?(event) ⇒ Boolean
42
43
44
45
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 42
def disabled?(event)
self::class::DISABLED.include?(event) \
|| @component.disabled?(event)
end
|
#enabled?(event, default = false) ⇒ Boolean
46
47
48
49
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 46
def enabled?(event, default=false)
self::class::ENABLED.include?(event) \
|| @component.enabled?(event, default)
end
|
#languages ⇒ Object
50
51
52
53
54
55
56
57
58
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 50
def languages
unless(@languages)
super
if(@languages.empty?)
@languages = @component.languages
end
end
@languages
end
|
#lookup(key, *args, &block) ⇒ Object
59
60
61
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 59
def lookup(key, *args, &block)
_lookup(key, *args) || @component.lookup(key, *args, &block)
end
|
#navigation(filter = true) ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 62
def navigation(filter=true)
nav = @component.navigation(false)
if(filter)
nav.select { |item|
key = (item.is_a? Symbol) ? item : item.direct_event
enabled?(key)
}
else
nav
end
end
|
#resource(rname, rstr = nil) ⇒ Object
73
74
75
76
77
78
79
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 73
def resource(rname, rstr=nil)
if(self::class::RESOURCES.include?(rname))
super
else
@component.resource(rname, rstr)
end
end
|
#resource_global(rname, rstr = nil) ⇒ Object
80
81
82
83
84
85
86
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 80
def resource_global(rname, rstr=nil)
if(self::class::RESOURCES.include?(rname))
super
else
@component.resource_global(rname, rstr)
end
end
|
#zone_navigation(filter = true) ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 87
def zone_navigation(filter=true)
nav = @component.zone_navigation(false)
if(filter)
nav.select { |item|
key = (item.is_a? Symbol) ? item : item.direct_event
enabled?(key)
}
else
nav
end
end
|
#zones(filter = true) ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 98
def zones(filter=true)
nav = @component.zones(false)
if(filter)
nav.select { |item|
key = (item.is_a? Symbol) ? item : item.direct_event
enabled?(key)
}
else
nav
end
end
|