Class: Emmett::Group

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#documentObject (readonly)

Returns the value of attribute document.



50
51
52
# File 'lib/emmett/document.rb', line 50

def document
  @document
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



48
49
50
# File 'lib/emmett/document.rb', line 48

def name
  @name
end

#slugObject (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

#endpointsObject



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_hashObject



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