Sha256: ab31503dd389d77d68cd6d85a6de9f7ca02e902e993705d52e182e879eb6ad49

Contents?: true

Size: 425 Bytes

Versions: 10

Compression:

Stored size: 425 Bytes

Contents

class BazaModels::Model::Reflection
  def initialize(relationship)
    @relationship = relationship
  end

  def class_name
    @relationship.fetch(:class_name)
  end

  def collection?
    @relationship.fetch(:type) == :has_many
  end

  def foreign_key
    @relationship.fetch(:foreign_key).to_s
  end

  def klass
    StringCases.constantize(class_name)
  end

  def name
    @relationship.fetch(:relation_name)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
baza_models-0.0.15 lib/baza_models/model/reflection.rb
baza_models-0.0.14 lib/baza_models/model/reflection.rb
baza_models-0.0.13 lib/baza_models/model/reflection.rb
baza_models-0.0.12 lib/baza_models/model/reflection.rb
baza_models-0.0.11 lib/baza_models/model/reflection.rb
baza_models-0.0.10 lib/baza_models/model/reflection.rb
baza_models-0.0.9 lib/baza_models/model/reflection.rb
baza_models-0.0.8 lib/baza_models/model/reflection.rb
baza_models-0.0.7 lib/baza_models/model/reflection.rb
baza_models-0.0.6 lib/baza_models/model/reflection.rb