Sha256: fa304acd1730cec78e02c9f83906c72f319d5956cdff5ecccac2e751c68af932

Contents?: true

Size: 850 Bytes

Versions: 3

Compression:

Stored size: 850 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? || false
  end

  private
  attr_reader :model, :association_opts, :attribute_opts
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_record_schema_scrapper-0.1.2 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.1.1 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.1.0 lib/active_record_schema_scrapper.rb