Class: Raddocs::IndexExample

Inherits:
Object
  • Object
show all
Defined in:
lib/raddocs/models.rb

Overview

Example model for the index page

Has an extra link attribute that is required only on this page.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ IndexExample

Returns a new instance of IndexExample.



36
37
38
39
# File 'lib/raddocs/models.rb', line 36

def initialize(attributes)
  @description = attributes.fetch("description")
  @link = attributes.fetch("link")
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



34
35
36
# File 'lib/raddocs/models.rb', line 34

def description
  @description
end

Returns the value of attribute link.



34
35
36
# File 'lib/raddocs/models.rb', line 34

def link
  @link
end

Instance Method Details

#hrefObject

Link to example page is the same name as the file minus “.json”



42
43
44
# File 'lib/raddocs/models.rb', line 42

def href
  link.gsub(".json", "")
end