Class: YARD::CodeObjects::CodeObjectList
- Defined in:
- lib/yard/code_objects/base.rb
Overview
A list of code objects. This array acts like a set (no unique items) but also disallows any Proxy objects from being added.
Instance Method Summary collapse
-
#initialize(owner = Registry.root) ⇒ CodeObjectList
constructor
Creates a new object list associated with a namespace.
-
#push(value) ⇒ CodeObjectList
(also: #<<)
Adds a new value to the list.
Methods inherited from Array
Constructor Details
#initialize(owner = Registry.root) ⇒ CodeObjectList
Creates a new object list associated with a namespace
11 12 13 |
# File 'lib/yard/code_objects/base.rb', line 11 def initialize(owner = Registry.root) @owner = owner end |
Instance Method Details
#push(value) ⇒ CodeObjectList Also known as: <<
Adds a new value to the list
19 20 21 22 23 24 25 26 27 |
# File 'lib/yard/code_objects/base.rb', line 19 def push(value) value = Proxy.new(@owner, value) if value.is_a?(String) || value.is_a?(Symbol) if value.is_a?(CodeObjects::Base) || value.is_a?(Proxy) super(value) unless include?(value) else raise ArgumentError, "#{value.class} is not a valid CodeObject" end self end |