Class: ActivePermalink::Localizer::PermalinkReader

Inherits:
Object
  • Object
show all
Defined in:
lib/active_permalink/localizer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(permalinks, options) ⇒ PermalinkReader

Returns a new instance of PermalinkReader.



36
37
38
39
# File 'lib/active_permalink/localizer.rb', line 36

def initialize(permalinks, options)
  @permalinks = permalinks
  @options    = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



34
35
36
# File 'lib/active_permalink/localizer.rb', line 34

def options
  @options
end

Returns the value of attribute permalinks.



34
35
36
# File 'lib/active_permalink/localizer.rb', line 34

def permalinks
  @permalinks
end

Instance Method Details

#exists?Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/active_permalink/localizer.rb', line 45

def exists?
  find_permalink(I18n.locale).present?
end

#fallbacks?Boolean

Returns:

  • (Boolean)


41
42
43
# File 'lib/active_permalink/localizer.rb', line 41

def fallbacks?
  options[:fallbacks].present?
end

#valueObject



49
50
51
# File 'lib/active_permalink/localizer.rb', line 49

def value
  find_slug(I18n.locale)
end