Class: CouchTap::Schema

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

Overview

Wrapper around a sequel table definition to allow easy access to column names.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(database, name) ⇒ Schema

Returns a new instance of Schema.



9
10
11
12
13
14
15
# File 'lib/couch_tap/schema.rb', line 9

def initialize(database, name)
  self.name         = name.to_sym
  self.database     = database
  self.columns      = {}
  self.column_names = []
  parse_schema
end

Instance Attribute Details

#column_namesObject

Returns the value of attribute column_names.



7
8
9
# File 'lib/couch_tap/schema.rb', line 7

def column_names
  @column_names
end

#columnsObject

Returns the value of attribute columns.



7
8
9
# File 'lib/couch_tap/schema.rb', line 7

def columns
  @columns
end

#databaseObject

Returns the value of attribute database.



7
8
9
# File 'lib/couch_tap/schema.rb', line 7

def database
  @database
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/couch_tap/schema.rb', line 7

def name
  @name
end

Instance Method Details

#datasetObject



17
18
19
# File 'lib/couch_tap/schema.rb', line 17

def dataset
  database[name]
end