module Kilt::Formatting
Public Class Methods
plural_name_of(object)
click to toggle source
# File lib/kilt/formatting.rb, line 12 def self.plural_name_of object singular_name_of(object).pluralize end
singular_name_of(object)
click to toggle source
# File lib/kilt/formatting.rb, line 5 def self.singular_name_of object simple_name_of(object) .split('_') .map { |x| x.capitalize } .join(' ') end
Private Class Methods
name_of_type_in_config(type)
click to toggle source
# File lib/kilt/formatting.rb, line 32 def name_of_type_in_config type kilt_type = Kilt.send(type) return nil unless kilt_type kilt_type['name'] end
simple_name_of(object)
click to toggle source
# File lib/kilt/formatting.rb, line 20 def simple_name_of object type = if object.is_a? Symbol object.to_s elsif object.is_a? String object else object.type.to_s end name_of_type_in_config(type) || type end