Class: AwesomeTranslations::Handlers::WillPaginateHandler

Inherits:
BaseHandler
  • Object
show all
Defined in:
lib/awesome_translations/handlers/will_paginate_handler.rb

Instance Method Summary collapse

Methods inherited from BaseHandler

#add_translations_for_hash, #translations_for_hash_recursive

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/awesome_translations/handlers/will_paginate_handler.rb', line 2

def enabled?
  ::Object.const_defined?(:WillPaginate)
end

#groupsObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/awesome_translations/handlers/will_paginate_handler.rb', line 6

def groups
  ArrayEnumerator.new do |yielder|
    groups = ["will_paginate"]

    groups.each do |group|
      yielder << AwesomeTranslations::Group.new(
        id: group,
        handler: self,
        data: {
          name: group.humanize
        }
      )
    end
  end
end

#translations_for_group(group) ⇒ Object



22
23
24
25
26
27
# File 'lib/awesome_translations/handlers/will_paginate_handler.rb', line 22

def translations_for_group(group)
  ArrayEnumerator.new do |yielder|
    dir = Rails.root.join("config", "locales", "awesome_translations", group.id).to_s
    __send__(:"translations_for_#{group.id}", dir, group, yielder)
  end
end