Class: Tripod::Links::LinkedFrom

Inherits:
Object
  • Object
show all
Defined in:
lib/tripod/links/linked_from.rb

Overview

Defines the behaviour for defined links in the resource.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, incoming_field_name, options = {}) ⇒ LinkedFrom

Create the new link with a name and optional additional options.



10
11
12
13
14
15
16
17
# File 'lib/tripod/links/linked_from.rb', line 10

def initialize(name, incoming_field_name, options = {})
  @name = name
  @options = options
  @incoming_field_name = incoming_field_name
  # if class name not supplied, guess from the field name
  @class_name = options[:class_name] || name.to_s.singularize.classify

end

Instance Attribute Details

#class_nameObject

Set readers for the instance variables.



7
8
9
# File 'lib/tripod/links/linked_from.rb', line 7

def class_name
  @class_name
end

#incoming_fieldObject

Set readers for the instance variables.



7
8
9
# File 'lib/tripod/links/linked_from.rb', line 7

def incoming_field
  @incoming_field
end

#incoming_field_nameObject

Set readers for the instance variables.



7
8
9
# File 'lib/tripod/links/linked_from.rb', line 7

def incoming_field_name
  @incoming_field_name
end

#nameObject

Set readers for the instance variables.



7
8
9
# File 'lib/tripod/links/linked_from.rb', line 7

def name
  @name
end

#optionsObject

Set readers for the instance variables.



7
8
9
# File 'lib/tripod/links/linked_from.rb', line 7

def options
  @options
end