Class: TableSchema::Column

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Column.



64
65
66
# File 'lib/rbhive/schema.rb', line 64

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

Instance Attribute Details

#commentObject (readonly)

Returns the value of attribute comment.



63
64
65
# File 'lib/rbhive/schema.rb', line 63

def comment
  @comment
end

#nameObject (readonly)

Returns the value of attribute name.



63
64
65
# File 'lib/rbhive/schema.rb', line 63

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



63
64
65
# File 'lib/rbhive/schema.rb', line 63

def type
  @type
end

Instance Method Details

#to_sObject



68
69
70
71
# File 'lib/rbhive/schema.rb', line 68

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