Class: RBHive::TableSchema::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/rbhive/table_schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, comment = nil) ⇒ Column

Returns a new instance of Column.



78
79
80
# File 'lib/rbhive/table_schema.rb', line 78

def initialize(name, type, comment=nil)
  @name, @type, @comment = name, type, comment
end

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



77
78
79
# File 'lib/rbhive/table_schema.rb', line 77

def comment
  @comment
end

#nameObject (readonly)

Returns the value of attribute name.



77
78
79
# File 'lib/rbhive/table_schema.rb', line 77

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



77
78
79
# File 'lib/rbhive/table_schema.rb', line 77

def type
  @type
end

Instance Method Details

#to_sObject



82
83
84
85
# File 'lib/rbhive/table_schema.rb', line 82

def to_s
  comment_string = @comment.nil? ? '' : " COMMENT '#{@comment}'"
  "`#{@name}` #{@type.to_s.upcase}#{comment_string}"
end