Class: Root
- Inherits:
-
Object
- Object
- Root
- Defined in:
- lib/root.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
Returns the value of attribute db.
-
#rails_root ⇒ Object
Returns the value of attribute rails_root.
Instance Method Summary collapse
- #database ⇒ Object
- #find_rails_root(single, force) ⇒ Object
-
#initialize(single, force) ⇒ Root
constructor
A new instance of Root.
Constructor Details
#initialize(single, force) ⇒ Root
5 6 7 |
# File 'lib/root.rb', line 5 def initialize(single, force) find_rails_root(single, force) end |
Instance Attribute Details
#db ⇒ Object
Returns the value of attribute db.
3 4 5 |
# File 'lib/root.rb', line 3 def db @db end |
#rails_root ⇒ Object
Returns the value of attribute rails_root.
3 4 5 |
# File 'lib/root.rb', line 3 def rails_root @rails_root end |
Instance Method Details
#database ⇒ Object
19 20 21 |
# File 'lib/root.rb', line 19 def database @db.load end |
#find_rails_root(single, force) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/root.rb', line 9 def find_rails_root(single, force) @rails_root = `pwd`.sub(/\n/, '') if File.directory? "#{@rails_root}/config" and File.directory? "#{@rails_root}/app" @db = Database.new(@rails_root, single, force) database else p 'Either this is not a rails app or you are not in the root of your rails app' end end |