Sha256: 1eede74f95046d36ab7d26ed177fd4c2c1d65c567bc57610746528d6ba2e40c8

Contents?: true

Size: 843 Bytes

Versions: 2

Compression:

Stored size: 843 Bytes

Contents

require "active_record_schema_scrapper/version"
require "active_record_schema_scrapper/attribute"
require "active_record_schema_scrapper/attributes"
require "active_record_schema_scrapper/association"
require "active_record_schema_scrapper/associations"

class ActiveRecordSchemaScrapper
  def initialize(model:, association_opts: {}, attribute_opts: {})
    @model            = model
    @association_opts = association_opts.merge(model: model)
    @attribute_opts   = attribute_opts.merge(model: model)
  end

  def associations
    @associations ||= Associations.new(association_opts)
  end

  def attributes
    @attributes ||= Attributes.new(attribute_opts)
  end

  def table_name
    model.table_name
  end

  def abstract_class?
    !!model.abstract_class?
  end

  private
  attr_reader :model, :association_opts, :attribute_opts
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_record_schema_scrapper-0.2.1 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.2.0 lib/active_record_schema_scrapper.rb