Class: Emmett::Group
- Inherits:
-
Struct
- Object
- Struct
- Emmett::Group
- 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
- #endpoints ⇒ Object
- #endpoints=(value) ⇒ Object
-
#initialize(name, document) ⇒ Group
constructor
A new instance of Group.
- #to_hash ⇒ Object
Constructor Details
#initialize(name, document) ⇒ Group
Returns a new instance of Group.
56 57 58 59 60 |
# File 'lib/emmett/document.rb', line 56 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.
50 51 52 |
# File 'lib/emmett/document.rb', line 50 def document @document end |
#name ⇒ Object
Returns the value of attribute name
48 49 50 |
# File 'lib/emmett/document.rb', line 48 def name @name end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
50 51 52 |
# File 'lib/emmett/document.rb', line 50 def slug @slug end |
Instance Method Details
#==(other) ⇒ Object
52 53 54 |
# File 'lib/emmett/document.rb', line 52 def ==(other) other.is_a?(self.class) && other.name == name end |
#endpoints ⇒ Object
71 72 73 |
# File 'lib/emmett/document.rb', line 71 def endpoints @endpoints ||= [] end |
#endpoints=(value) ⇒ Object
75 76 77 |
# File 'lib/emmett/document.rb', line 75 def endpoints=(value) @endpoints = Array value end |
#to_hash ⇒ Object
62 63 64 65 66 67 68 69 |
# File 'lib/emmett/document.rb', line 62 def to_hash { :name => name, :slug => slug, :endpoints => endpoints.map(&:to_hash), :url => document.to_path_name } end |