Class: Rid::App
- Inherits:
-
Object
- Object
- Rid::App
- Defined in:
- lib/rid/app.rb
Overview
Holds Application config
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns an instance of Rid::Database, configured with db_name.
-
#db_url ⇒ Object
readonly
Returns the value of attribute db_url.
-
#root ⇒ Object
Returns the value of attribute root.
Instance Method Summary collapse
-
#documents ⇒ Object
List application documents.
-
#initialize(options = OpenStruct.new) ⇒ App
constructor
Initialize app with an options object, which behaves like an open struct.
Constructor Details
#initialize(options = OpenStruct.new) ⇒ App
Initialize app with an options object, which behaves like an open struct.
Options are:
root: specify app root directory
database: set database name
15 16 17 18 19 20 21 22 |
# File 'lib/rid/app.rb', line 15 def initialize( = OpenStruct.new) @root = .root @root ||= find_root @root = Pathname.new(@root) @db_url = .database @db_url ||= read_db_url end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns an instance of Rid::Database, configured with db_name.
27 28 29 |
# File 'lib/rid/app.rb', line 27 def db @db end |
#db_url ⇒ Object (readonly)
Returns the value of attribute db_url.
5 6 7 |
# File 'lib/rid/app.rb', line 5 def db_url @db_url end |
#root ⇒ Object
Returns the value of attribute root.
6 7 8 |
# File 'lib/rid/app.rb', line 6 def root @root end |