Class: FabulatorExhibitExtension::Database
- Inherits:
-
Object
- Object
- FabulatorExhibitExtension::Database
- Defined in:
- lib/fabulator_exhibit_extension/database.rb
Instance Method Summary collapse
- #[](t) ⇒ Object
-
#initialize(db) ⇒ Database
constructor
A new instance of Database.
- #to_json ⇒ Object
Constructor Details
#initialize(db) ⇒ Database
Returns a new instance of Database.
3 4 5 6 7 8 9 10 |
# File 'lib/fabulator_exhibit_extension/database.rb', line 3 def initialize(db) @db = db @info = { :items => ItemCollection.new(@db), :properties => PropertyCollection.new(@db), :types => TypeCollection.new(@db) } end |
Instance Method Details
#[](t) ⇒ Object
19 20 21 |
# File 'lib/fabulator_exhibit_extension/database.rb', line 19 def [](t) @info[t.to_sym] end |
#to_json ⇒ Object
12 13 14 15 16 17 |
# File 'lib/fabulator_exhibit_extension/database.rb', line 12 def to_json '{ "items":' + @info[:items].to_json + ', ' + ' "types":' + @info[:types].to_json + ', ' + ' "properties":' + @info[:properties].to_json + '}' end |