module ActsAsMoonable::Humanable::ClassMethods
Public Instance Methods
human_action_name(action, views="defaults")
click to toggle source
# File lib/acts_as_moonable/humanable.rb, line 10 def human_action_name action, views="defaults" I18n.t("#{views}.action.#{action}", model: self.model_name.human) end
human_array_choices(enum_name)
click to toggle source
# File lib/acts_as_moonable/humanable.rb, line 23 def human_array_choices enum_name array_values = self.const_get enum_name.to_s.pluralize.upcase array_values.map { |enum_value| [ self.human_enum_name(enum_name, enum_value), enum_value ] } end
human_enum_choices(enum_name)
click to toggle source
# File lib/acts_as_moonable/humanable.rb, line 18 def human_enum_choices enum_name enum_hash = self.public_send enum_name.to_s.pluralize enum_hash.keys.map { |enum_value| [ self.human_enum_name(enum_name, enum_value), enum_value ] } end
human_enum_name(enum_name, enum_value)
click to toggle source
# File lib/acts_as_moonable/humanable.rb, line 14 def human_enum_name(enum_name, enum_value) self.human_attribute_name "#{enum_name}.#{enum_value}" end
i18n_attribute_name(attr)
click to toggle source
# File lib/acts_as_moonable/humanable.rb, line 6 def i18n_attribute_name attr self.human_attribute_name attr end