Class: ActiveItem::Configuration
- Inherits:
-
Object
- Object
- ActiveItem::Configuration
- Defined in:
- lib/active_item/configuration.rb
Instance Attribute Summary collapse
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#table_prefix ⇒ Object
Returns the value of attribute table_prefix.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#table_name_for(class_name) ⇒ Object
Generates table name from model class name using configured prefix/env Pattern: prefix-env-model-name-pluralized If no prefix configured, just uses the model name pluralized+dasherized.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 |
# File 'lib/active_item/configuration.rb', line 9 def initialize @logger = NullLogger.new @table_prefix = nil @environment = nil end |
Instance Attribute Details
#environment ⇒ Object
Returns the value of attribute environment.
7 8 9 |
# File 'lib/active_item/configuration.rb', line 7 def environment @environment end |
#logger ⇒ Object
Returns the value of attribute logger.
7 8 9 |
# File 'lib/active_item/configuration.rb', line 7 def logger @logger end |
#table_prefix ⇒ Object
Returns the value of attribute table_prefix.
7 8 9 |
# File 'lib/active_item/configuration.rb', line 7 def table_prefix @table_prefix end |
Instance Method Details
#table_name_for(class_name) ⇒ Object
Generates table name from model class name using configured prefix/env Pattern: prefix-env-model-name-pluralized If no prefix configured, just uses the model name pluralized+dasherized
18 19 20 21 22 |
# File 'lib/active_item/configuration.rb', line 18 def table_name_for(class_name) base = class_name.underscore.dasherize.pluralize parts = [table_prefix, environment, base].compact parts.join('-') end |