Sha256: f2768f0cd22880d5be4afaa433059b44c20cb0ea617c68aec8995e1dc6455cf2

Contents?: true

Size: 342 Bytes

Versions: 5

Compression:

Stored size: 342 Bytes

Contents

module ActiveMocker

  class Table

    attr_reader :name, :fields

    def initialize(name, fields=[])
      @name   = name
      @fields = fields
      fields.unshift Field.new('id', :integer, {})
    end

    def to_h
      {name: name, fields: fields.to_h}
    end

    def column_names
      fields.map { |f| f.name }
    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
active_mocker-1.1.23 lib/active_mocker/table.rb
active_mocker-1.1.22 lib/active_mocker/table.rb
active_mocker-1.1.21 lib/active_mocker/table.rb
active_mocker-1.1.20 lib/active_mocker/table.rb
active_mocker-1.1.11 lib/active_mocker/table.rb