Sha256: b23915eb53d1b4680e55bcc446d882bf4d4aa0b1183da76b969fe021538a448f
Contents?: true
Size: 415 Bytes
Versions: 5
Compression:
Stored size: 415 Bytes
Contents
module ActiveMocker class Table attr_reader :name, :fields def initialize(name, id=true, fields=[]) @name = name @fields = fields fields.unshift Field.new('id', :integer, [{primary_key: true}]) if id.nil? end def to_h {name: name, fields: fields.to_h} end alias_method :to_hash, :to_h def column_names fields.map { |f| f.name } end end end
Version data entries
5 entries across 5 versions & 1 rubygems