Class: Perfectline::LocaleRouting::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/locale_routing/config.rb

Class Method Summary collapse

Class Method Details

.bootstrapObject

straps the LocaleRouteSet module into ActionControllers RouteSet



53
54
55
# File 'lib/locale_routing/config.rb', line 53

def bootstrap
  ActionController::Routing::RouteSet.send(:include, Perfectline::LocaleRouting::LocaleRouteSet) if self.enabled?
end

.enabled=(enabled) ⇒ Object



28
29
30
# File 'lib/locale_routing/config.rb', line 28

def enabled=(enabled)
  @enabled = (enabled.nil? || enabled == false) ? false : true
end

.enabled?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/locale_routing/config.rb', line 24

def enabled?
  @enabled
end

.host_mappingObject



44
45
46
# File 'lib/locale_routing/config.rb', line 44

def host_mapping
  @host_mapping
end

.mapping {|Mapper.new(@host_mapping)| ... } ⇒ Object

Yields:



48
49
50
# File 'lib/locale_routing/config.rb', line 48

def mapping
  yield Mapper.new(@host_mapping)
end

.match_fromObject



32
33
34
# File 'lib/locale_routing/config.rb', line 32

def match_from
  @match_from
end

.match_from=(location) ⇒ Object



36
37
38
39
40
41
42
# File 'lib/locale_routing/config.rb', line 36

def match_from=(location)
  unless @locale_match_options.include?(location.to_sym)
    raise "#{location.to_sym} is not supported as Perfectline::LocaleRouting.match_from option."
  end

  @match_from = location.to_sym
end