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.



112
113
114
# File 'lib/rbhive/table_schema.rb', line 112

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

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



111
112
113
# File 'lib/rbhive/table_schema.rb', line 111

def comment
  @comment
end

#nameObject (readonly)

Returns the value of attribute name.



111
112
113
# File 'lib/rbhive/table_schema.rb', line 111

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



111
112
113
# File 'lib/rbhive/table_schema.rb', line 111

def type
  @type
end

Instance Method Details

#to_sObject



116
117
118
119
# File 'lib/rbhive/table_schema.rb', line 116

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