Sha256: d1800f7df51b46a8b63afddd2ea87c3b5d110cd903a70af365cd27902ed6a491

Contents?: true

Size: 896 Bytes

Versions: 8

Compression:

Stored size: 896 Bytes

Contents

require "active_record_schema_scrapper/version"
require "active_record_schema_scrapper/object_error"
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

8 entries across 8 versions & 1 rubygems

Version Path
active_record_schema_scrapper-0.9.0 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.8.0 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.6.1 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.6.0 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.5.0 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.4.0 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.3.0 lib/active_record_schema_scrapper.rb
active_record_schema_scrapper-0.2.2 lib/active_record_schema_scrapper.rb