Sha256: 22c8d7235b15ef04434980ba5b4b628391bf8c5ad81213f704b5f0f9cd8cff06

Contents?: true

Size: 415 Bytes

Versions: 13

Compression:

Stored size: 415 Bytes

Contents

class AssociationReflection
  attr_reader :macro
  attr_reader :name
  attr_reader :options

  def initialize(macro, name, options = {})
    @macro = macro
    @name = name
    @options = options
  end

  def class_name
    @class_name ||= (options[:type] || derive_class_name).to_s
  end

  def klass
    @klass ||= class_name.constantize
  end

  private

  def derive_class_name
    name.to_s.camelize
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
spira-3.3.0 lib/spira/association_reflection.rb
spira-3.2.0 lib/spira/association_reflection.rb
spira-3.1.1 lib/spira/association_reflection.rb
spira-3.1.0 lib/spira/association_reflection.rb
spira-3.0.0 lib/spira/association_reflection.rb
spira-2.1.0 lib/spira/association_reflection.rb
spira-2.0.2 lib/spira/association_reflection.rb
spira-2.0.1 lib/spira/association_reflection.rb
spira-2.0.0 lib/spira/association_reflection.rb
spira-1.1.1 lib/spira/association_reflection.rb
spira-0.7.1 lib/spira/association_reflection.rb
spira-0.7 lib/spira/association_reflection.rb
spira-0.5.0 lib/spira/association_reflection.rb