Class: AASM::Localizer

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

Instance Method Summary collapse

Instance Method Details

#human_event_name(klass, event) ⇒ Object


3
4
5
6
7
8
9
# File 'lib/aasm/localizer.rb', line 3

def human_event_name(klass, event)
  checklist = ancestors_list(klass).inject([]) do |list, ancestor|
    list << :"#{i18n_scope(klass)}.events.#{i18n_klass(ancestor)}.#{event}"
    list
  end
  translate_queue(checklist) || I18n.translate(checklist.shift, :default => default_display_name(event))
end

#human_state_name(klass, state) ⇒ Object


11
12
13
14
15
16
17
18
# File 'lib/aasm/localizer.rb', line 11

def human_state_name(klass, state)
  checklist = ancestors_list(klass).inject([]) do |list, ancestor|
    list << item_for(klass, state, ancestor)
    list << item_for(klass, state, ancestor, :old_style => true)
    list
  end
  translate_queue(checklist) || I18n.translate(checklist.shift, :default => default_display_name(state))
end