Module: HumanAttributes

Extended by:
HumanAttributes
Included in:
HumanAttributes
Defined in:
lib/human_attributes.rb,
lib/human_attributes/config.rb,
lib/human_attributes/engine.rb,
lib/human_attributes/errors.rb,
lib/human_attributes/version.rb,
lib/human_attributes/extension.rb,
lib/human_attributes/method_builder.rb,
lib/human_attributes/formatters/base.rb,
lib/human_attributes/formatters/date.rb,
lib/human_attributes/formatters/custom.rb,
lib/human_attributes/formatters/boolean.rb,
lib/human_attributes/formatters/numeric.rb,
lib/human_attributes/formatters_builder.rb,
lib/human_attributes/formatters/datetime.rb,
lib/human_attributes/formatters/enumerize.rb

Defined Under Namespace

Modules: Config, Error, Extension, Formatters Classes: Engine, FormattersBuilder, MethodBuilder

Constant Summary collapse

VERSION =
"0.6.0"

Instance Method Summary collapse

Instance Method Details

#setup {|_self| ... } ⇒ Object

You can add, in this module, your own configuration options as in the example below…

attr_writer :my_option

def my_option

return "Default Value" unless @my_option
@my_option

end

Then, you can customize the default behaviour (typically in a Rails initializer) like this:

HumanAttributes.setup do |config|

config.root_url = "Another value"

end

Yields:

  • (_self)

Yield Parameters:


21
22
23
24
# File 'lib/human_attributes.rb', line 21

def setup
  yield self
  require "human_attributes"
end