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.



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

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

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



30
31
32
# File 'lib/raddocs/models.rb', line 30

def description
  @description
end

Returns the value of attribute link.



30
31
32
# File 'lib/raddocs/models.rb', line 30

def link
  @link
end

Instance Method Details

#hrefObject

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



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

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