Class: WeaselDiesel::Documentation::ElementDoc

Inherits:
Object
  • Object
show all
Defined in:
lib/documentation.rb

Overview

This class contains the documentation information regarding an element. Currently, elements are only used in the response info.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ElementDoc

Returns a new instance of ElementDoc.

Parameters:

  • The (String)

    element’s name



33
34
35
36
37
# File 'lib/documentation.rb', line 33

def initialize(name)
  # raise ArgumentError, "An Element doc needs to be initialize by passing a hash with a ':name' keyed entry." unless opts.is_a?(Hash) && opts.has_key?(:name)
  @name       = name
  @attributes = {}
end

Instance Attribute Details

#attributesObject (readonly)



29
30
31
# File 'lib/documentation.rb', line 29

def attributes
  @attributes
end

#nameObject (readonly)



29
30
31
# File 'lib/documentation.rb', line 29

def name
  @name
end

Instance Method Details

#attribute(name, desc) ⇒ Object

Parameters:

  • name (String)

    The name of the attribute described

  • desc (String)

    The description of the attribute



42
43
44
# File 'lib/documentation.rb', line 42

def attribute(name, desc)
  @attributes[name] = desc
end