Class: Arfy::MigrationBuilder::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/arfy/migration_builder/builders/column.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value = nil) ⇒ Option

Returns a new instance of Option.



48
49
50
51
52
# File 'lib/arfy/migration_builder/builders/column.rb', line 48

def initialize(name, value=nil)
  super
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



47
48
49
# File 'lib/arfy/migration_builder/builders/column.rb', line 47

def name
  @name
end

#valueObject (readonly)

Returns the value of attribute value.



47
48
49
# File 'lib/arfy/migration_builder/builders/column.rb', line 47

def value
  @value
end

Instance Method Details

#value_stringObject



54
55
56
57
58
59
60
61
62
63
64
# File 'lib/arfy/migration_builder/builders/column.rb', line 54

def value_string
  value_string = ""
  if @value.class == String
    value_string = "\"#{@value}\""
  elsif @value.class == Symbol
    value_string = ":#{@value}"
  else
    value_string = @value.to_s
  end
  value_string
end