Class: ChefWorkflow::DatabaseSupport::Generic
- Inherits:
-
Object
- Object
- ChefWorkflow::DatabaseSupport::Generic
- Defined in:
- lib/chef-workflow/support/db/basic.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#db ⇒ Object
Returns the value of attribute db.
Class Method Summary collapse
Instance Method Summary collapse
- #_dump(level) ⇒ Object
- #create_table ⇒ Object
-
#initialize(table_name, object_name = nil) ⇒ Generic
constructor
A new instance of Generic.
- #post_marshal_init ⇒ Object
Constructor Details
#initialize(table_name, object_name = nil) ⇒ Generic
Returns a new instance of Generic.
8 9 10 11 12 13 14 15 |
# File 'lib/chef-workflow/support/db/basic.rb', line 8 def initialize(table_name, object_name=nil) raise "a table_name must be provided!" unless table_name @table_name = table_name @object_name = object_name post_marshal_init create_table end |
Instance Attribute Details
#db ⇒ Object
Returns the value of attribute db.
6 7 8 |
# File 'lib/chef-workflow/support/db/basic.rb', line 6 def db @db end |
Class Method Details
._load(value) ⇒ Object
17 18 19 20 |
# File 'lib/chef-workflow/support/db/basic.rb', line 17 def self._load(value) obj = self.new(*Marshal.load(value)) return obj end |
Instance Method Details
#_dump(level) ⇒ Object
22 23 24 25 26 27 |
# File 'lib/chef-workflow/support/db/basic.rb', line 22 def _dump(level) self.db = nil res = Marshal.dump([@table_name, @object_name]) post_marshal_init return res end |
#create_table ⇒ Object
33 34 35 |
# File 'lib/chef-workflow/support/db/basic.rb', line 33 def create_table raise "Do not use the Generic type directly!" end |
#post_marshal_init ⇒ Object
29 30 31 |
# File 'lib/chef-workflow/support/db/basic.rb', line 29 def post_marshal_init @db = ChefWorkflow::DatabaseSupport.instance end |