Class: TableQuery::Table
- Inherits:
-
Object
- Object
- TableQuery::Table
- Defined in:
- lib/table-query/table.rb
Overview
Table is a class for loading table data/schema files and providing interfaces for query.
Instance Attribute Summary collapse
- #csv ⇒ Object readonly private
-
#query_schemas ⇒ Object
readonly
table query schema list.
-
#table_schema ⇒ Object
readonly
table schema.
-
#types ⇒ Object
readonly
table field type list.
Instance Method Summary collapse
-
#initialize(path, options = {}) ⇒ Table
constructor
Create a new table.
-
#schema_path ⇒ String
Return schema filename.
Constructor Details
#initialize(path, options = {}) ⇒ Table
Create a new table.
23 24 25 26 27 28 29 |
# File 'lib/table-query/table.rb', line 23 def initialize(path, ={}) @path = path @csv = CSV.read(path) eval_schema_file setup_query_schemas end |
Instance Attribute Details
#csv ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/table-query/table.rb', line 15 def csv @csv end |
#query_schemas ⇒ Object (readonly)
table query schema list
12 13 14 |
# File 'lib/table-query/table.rb', line 12 def query_schemas @query_schemas end |
#table_schema ⇒ Object (readonly)
table schema
9 10 11 |
# File 'lib/table-query/table.rb', line 9 def table_schema @table_schema end |
#types ⇒ Object (readonly)
table field type list
6 7 8 |
# File 'lib/table-query/table.rb', line 6 def types @types end |
Instance Method Details
#schema_path ⇒ String
Return schema filename.
35 36 37 38 |
# File 'lib/table-query/table.rb', line 35 def schema_path name = "%s-schema.rb" % File.basename(@path, ".*") File.join(File.dirname(@path), name) end |