Class: DataMapper::Is::Friendly::FriendlyConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/dm-is-friendly/is/friendly.rb

Overview

This class holds the configuration options for the plugin.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ref_model_name, friendship_class, require_acceptance) ⇒ FriendlyConfig

Returns a new instance of FriendlyConfig.



41
42
43
44
45
46
47
# File 'lib/dm-is-friendly/is/friendly.rb', line 41

def initialize(ref_model_name, friendship_class, require_acceptance)
  @reference_model_name        = ref_model_name
  @friendship_class_name  = friendship_class
  @friendship_foreign_key = DataMapper::Inflector.foreign_key(@reference_model_name).to_sym
  @friend_foreign_key     = DataMapper::Inflector.foreign_key(@friendship_class_name).to_sym
  @require_acceptance     = require_acceptance
end

Instance Attribute Details

#friend_foreign_keyObject (readonly)

Returns the value of attribute friend_foreign_key.



39
40
41
# File 'lib/dm-is-friendly/is/friendly.rb', line 39

def friend_foreign_key
  @friend_foreign_key
end

#friendship_foreign_keyObject (readonly)

Returns the value of attribute friendship_foreign_key.



39
40
41
# File 'lib/dm-is-friendly/is/friendly.rb', line 39

def friendship_foreign_key
  @friendship_foreign_key
end

#reference_model_nameObject (readonly)

Returns the value of attribute reference_model_name.



39
40
41
# File 'lib/dm-is-friendly/is/friendly.rb', line 39

def reference_model_name
  @reference_model_name
end

Instance Method Details

#friendship_classObject



49
50
51
# File 'lib/dm-is-friendly/is/friendly.rb', line 49

def friendship_class
  DataMapper::Ext::Object.full_const_get(@friendship_class_name)
end

#require_acceptance?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/dm-is-friendly/is/friendly.rb', line 53

def require_acceptance?
  @require_acceptance
end