class HumanAttributes::Formatters::Base

Attributes

attribute[R]
default[R]
options[R]
suffix[R]
type[R]

Public Class Methods

new(attribute, type, options) click to toggle source
# File lib/human_attributes/formatters/base.rb, line 8
def initialize(attribute, type, options)
  @attribute = attribute.to_sym
  @type = type.to_sym
  @default = options[:default]
  @suffix = options[:suffix]
  @options = options
end

Public Instance Methods

apply(_instance, _value) click to toggle source
# File lib/human_attributes/formatters/base.rb, line 23
def apply(_instance, _value)
  raise_error('NotImplemented')
end
method_name() click to toggle source
# File lib/human_attributes/formatters/base.rb, line 16
def method_name
  return "human_#{attribute}" if suffix.blank?
  return "#{attribute}_#{suffix_by_type(type)}" if suffix == true

  "#{attribute}_#{suffix}"
end