Skip to content

Instantly share code, notes, and snippets.

@lumentut
Created July 9, 2021 09:41
Show Gist options
  • Save lumentut/9a02a0b7680884018f82b02947de52fc to your computer and use it in GitHub Desktop.
Save lumentut/9a02a0b7680884018f82b02947de52fc to your computer and use it in GitHub Desktop.
Data types principle
class DataTypes
def col(name, args)
puts name
puts args
end
end
class Test
def column_defs(&block)
yield DataTypes.new
end
end
test = Test.new
test.column_defs do |q|
q.col :satu ,type: :string, length: 10
q.col :dua ,type: :integer, length: 5
q.col :tiga ,type: :boolean, default: true
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment