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.
31
32
33
34
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 31
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
35
36
37
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 35
def method_missing(symbol, *args, &block)
@component.send(symbol, *args, &block)
end
|
Instance Method Details
#attributes(key) ⇒ Object
38
39
40
41
42
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 38
def attributes(key)
self::class::HTML_ATTRIBUTES.fetch(key.to_sym) {
@component.attributes(key)
}
end
|
#disabled?(event) ⇒ Boolean
43
44
45
46
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 43
def disabled?(event)
self::class::DISABLED.include?(event) \
|| @component.disabled?(event)
end
|
#enabled?(event, default = false) ⇒ Boolean
47
48
49
50
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 47
def enabled?(event, default=false)
self::class::ENABLED.include?(event) \
|| @component.enabled?(event, default)
end
|
#languages ⇒ Object
51
52
53
54
55
56
57
58
59
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 51
def languages
unless(@languages)
super
if(@languages.empty?)
@languages = @component.languages
end
end
@languages
end
|
#lookup(key, *args, &block) ⇒ Object
60
61
62
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 60
def lookup(key, *args, &block)
_lookup(key, *args) || @component.lookup(key, *args, &block)
end
|
#navigation(filter = true) ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 63
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
74
75
76
77
78
79
80
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 74
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
81
82
83
84
85
86
87
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 81
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
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 88
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
99
100
101
102
103
104
105
106
107
108
109
|
# File 'lib/sbsm/lookandfeelwrapper.rb', line 99
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
|