Class: Adjective::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/adjective.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



40
41
42
43
44
45
46
47
48
49
50
# File 'lib/adjective.rb', line 40

def initialize
  @use_active_record = true
  @use_rails = defined?(Rails) ? true : false
  # Need to set this up to ensure that if AR is off, it doesn't auto-set shit.

  @root = use_rails ? Rails.root : "."

  @config_file_path = "#{root}/config/initializers/adjective.rb"
  @migration_path = "#{root}/db/migrate"
  @models_path = "#{root}/app/models"
end

Instance Attribute Details

#config_file_pathObject

Returns the value of attribute config_file_path.



38
39
40
# File 'lib/adjective.rb', line 38

def config_file_path
  @config_file_path
end

#migration_pathObject

Returns the value of attribute migration_path.



38
39
40
# File 'lib/adjective.rb', line 38

def migration_path
  @migration_path
end

#models_pathObject

Returns the value of attribute models_path.



38
39
40
# File 'lib/adjective.rb', line 38

def models_path
  @models_path
end

#rootObject

Returns the value of attribute root.



38
39
40
# File 'lib/adjective.rb', line 38

def root
  @root
end

#use_active_recordObject

Returns the value of attribute use_active_record.



38
39
40
# File 'lib/adjective.rb', line 38

def use_active_record
  @use_active_record
end

#use_railsObject

Returns the value of attribute use_rails.



38
39
40
# File 'lib/adjective.rb', line 38

def use_rails
  @use_rails
end

Instance Method Details

#set_new_root(root_path) ⇒ Object



52
53
54
55
56
57
# File 'lib/adjective.rb', line 52

def set_new_root(root_path)
  @root = root_path
  @config_file_path = "#{root_path}/config/initializers/adjective.rb"
  @migration_path = "#{root_path}/db/migrate"
  @models_path = "#{root_path}/app/models"      
end