Class: PeakFlowUtils::DeviseHandler

Inherits:
ApplicationHandler show all
Defined in:
app/handlers/peak_flow_utils/devise_handler.rb

Overview

rubocop:disable Layout/LineLength

Instance Method Summary collapse

Methods inherited from ApplicationHandler

#add_translations_for_hash, #translations_for_hash_recursive

Instance Method Details

#enabled?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'app/handlers/peak_flow_utils/devise_handler.rb', line 3

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

#groupsObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/handlers/peak_flow_utils/devise_handler.rb', line 7

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

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

#translations_for_group(group) ⇒ Object



23
24
25
26
27
28
# File 'app/handlers/peak_flow_utils/devise_handler.rb', line 23

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