Class: Emmett::Endpoint
- Inherits:
-
Struct
- Object
- Struct
- Emmett::Endpoint
- Defined in:
- lib/emmett/document.rb
Instance Attribute Summary collapse
-
#document ⇒ Object
readonly
Returns the value of attribute document.
-
#name ⇒ Object
Returns the value of attribute name.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, document) ⇒ Endpoint
constructor
A new instance of Endpoint.
- #to_hash ⇒ Object
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
#document ⇒ Object (readonly)
Returns the value of attribute document.
87 88 89 |
# File 'lib/emmett/document.rb', line 87 def document @document end |
#name ⇒ Object
Returns the value of attribute name
81 82 83 |
# File 'lib/emmett/document.rb', line 81 def name @name end |
#slug ⇒ Object (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_hash ⇒ Object
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 |