Class: Parameter

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

Instance Attribute Summary collapse

Attributes inherited from Node

#children, #level, #name, #parent

Instance Method Summary collapse

Methods inherited from Node

#add_child, #all_children, #print, #print_children, #root, #root?

Constructor Details

#initialize(n = nil) ⇒ Parameter

Returns a new instance of Parameter.



206
207
208
209
# File 'lib/rest.rb', line 206

def initialize n = nil
  @optional = false
  super
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



204
205
206
# File 'lib/rest.rb', line 204

def description
  @description
end

#optionalObject

Returns the value of attribute optional.



204
205
206
# File 'lib/rest.rb', line 204

def optional
  @optional
end

Instance Method Details

#to_sObject



211
212
213
214
215
216
217
218
219
# File 'lib/rest.rb', line 211

def to_s
  s = @name.to_s
  s += " (optional)" if @optional
  if ( !@description || @description.empty? )
    s
  else
    s + " - " + @description
  end
end