Class: Contentful::Bootstrap::Templates::Links::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/contentful/bootstrap/templates/links/base.rb

Direct Known Subclasses

Asset, Entry

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Base

Returns a new instance of Base.



9
10
11
# File 'lib/contentful/bootstrap/templates/links/base.rb', line 9

def initialize(id)
  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/contentful/bootstrap/templates/links/base.rb', line 8

def id
  @id
end

Instance Method Details

#==(other) ⇒ Object



31
32
33
34
# File 'lib/contentful/bootstrap/templates/links/base.rb', line 31

def ==(other)
  return false unless other.is_a? self.class
  other.id == id
end


13
14
15
# File 'lib/contentful/bootstrap/templates/links/base.rb', line 13

def link_type
  self.class.name.split('::').last
end

#management_classObject



27
28
29
# File 'lib/contentful/bootstrap/templates/links/base.rb', line 27

def management_class
  raise 'must implement'
end

#to_management_objectObject



21
22
23
24
25
# File 'lib/contentful/bootstrap/templates/links/base.rb', line 21

def to_management_object
  object = management_class.new
  object.id = id
  object
end

#typeObject



17
18
19
# File 'lib/contentful/bootstrap/templates/links/base.rb', line 17

def type
  Contentful::Management::ContentType::LINK
end