Class: Emmett::Endpoint

Inherits:
Struct
  • Object
show all
Defined in:
lib/emmett/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, document) ⇒ Endpoint

Returns a new instance of Endpoint.



89
90
91
92
93
# File 'lib/emmett/document.rb', line 89

def initialize(name, document)
  @slug = Emmett.normalize_name name
  @document = document
  super name
end

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



87
88
89
# File 'lib/emmett/document.rb', line 87

def document
  @document
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



81
82
83
# File 'lib/emmett/document.rb', line 81

def name
  @name
end

#slugObject (readonly)

Returns the value of attribute slug.



87
88
89
# File 'lib/emmett/document.rb', line 87

def slug
  @slug
end

Instance Method Details

#==(other) ⇒ Object



83
84
85
# File 'lib/emmett/document.rb', line 83

def ==(other)
  other.is_a?(self.class) && other.name == name
end

#to_hashObject



95
96
97
98
99
100
101
# File 'lib/emmett/document.rb', line 95

def to_hash
  {
    :name => name,
    :slug => slug,
    :url  => "#{document.to_path_name}##{slug}"
  }
end