Class: MobileEnhancements::Configuration
- Inherits:
-
Object
- Object
- MobileEnhancements::Configuration
- Defined in:
- lib/mobile_enhancements/configuration.rb
Defined Under Namespace
Classes: Options
Class Method Summary collapse
Instance Method Summary collapse
- #desktop_layout ⇒ Object
-
#initialize(&block) ⇒ Configuration
constructor
A new instance of Configuration.
- #mobile(&block) ⇒ Object (also: #desktop)
- #mobile_format ⇒ Object
- #mobile_layout ⇒ Object
- #mobile_path_prefix ⇒ Object
Constructor Details
#initialize(&block) ⇒ Configuration
Returns a new instance of Configuration.
17 18 19 |
# File 'lib/mobile_enhancements/configuration.rb', line 17 def initialize(&block) instance_eval(&block) if block_given? end |
Class Method Details
.default ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/mobile_enhancements/configuration.rb', line 3 def self.default new do mobile do prefix "mobile" layout "application" format "mobile" end desktop do layout "application" end end end |
Instance Method Details
#desktop_layout ⇒ Object
39 40 41 |
# File 'lib/mobile_enhancements/configuration.rb', line 39 def desktop_layout desktop.layout end |
#mobile(&block) ⇒ Object Also known as: desktop
21 22 23 24 25 26 27 28 |
# File 'lib/mobile_enhancements/configuration.rb', line 21 def mobile(&block) @options ||= {} @options[__method__] ||= Options.new if block_given? @options[__method__].instance_eval(&block) end @options[__method__] end |
#mobile_format ⇒ Object
43 44 45 46 47 |
# File 'lib/mobile_enhancements/configuration.rb', line 43 def mobile_format if mobile.format && mobile.format.to_sym != :html mobile.format.to_sym end end |
#mobile_layout ⇒ Object
35 36 37 |
# File 'lib/mobile_enhancements/configuration.rb', line 35 def mobile_layout mobile.layout end |
#mobile_path_prefix ⇒ Object
31 32 33 |
# File 'lib/mobile_enhancements/configuration.rb', line 31 def mobile_path_prefix mobile.prefix.gsub(/^\/|\/$/, "") end |