Class: Egis::TableSchema
- Inherits:
- 
      Object
      
        - Object
- Egis::TableSchema
 
- Defined in:
- lib/egis/table_schema.rb
Overview
Provides DSL for defining table schemas.
Defined Under Namespace
Classes: Column
Instance Attribute Summary collapse
- #columns ⇒ Egis::TableSchema::Column readonly
- #partitions ⇒ Egis::TableSchema::Column readonly
Class Method Summary collapse
Instance Method Summary collapse
- 
  
    
      #initialize(&block)  ⇒ TableSchema 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of TableSchema. 
Constructor Details
#initialize(&block) ⇒ TableSchema
Returns a new instance of TableSchema.
| 29 30 31 32 33 | # File 'lib/egis/table_schema.rb', line 29 def initialize(&block) @columns = [] @partitions = [] instance_eval(&block) end | 
Instance Attribute Details
#columns ⇒ Egis::TableSchema::Column (readonly)
| 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # File 'lib/egis/table_schema.rb', line 21 class TableSchema ## # @return [Egis::TableSchema] def self.define(&block) new(&block) end def initialize(&block) @columns = [] @partitions = [] instance_eval(&block) end attr_reader :columns, :partitions private def column(name, type) @columns << Column.new(name, type) end def partition(name, type) @partitions << Column.new(name, type) end Column = Struct.new(:name, :type) end | 
#partitions ⇒ Egis::TableSchema::Column (readonly)
| 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | # File 'lib/egis/table_schema.rb', line 21 class TableSchema ## # @return [Egis::TableSchema] def self.define(&block) new(&block) end def initialize(&block) @columns = [] @partitions = [] instance_eval(&block) end attr_reader :columns, :partitions private def column(name, type) @columns << Column.new(name, type) end def partition(name, type) @partitions << Column.new(name, type) end Column = Struct.new(:name, :type) end | 
Class Method Details
.define(&block) ⇒ Egis::TableSchema
| 25 26 27 | # File 'lib/egis/table_schema.rb', line 25 def self.define(&block) new(&block) end |