Class: RubyCop::Ruby::List
Direct Known Subclasses
Args, Array, MultiAssignmentList, Params, RescueParams, Statements, String, StringConcat
Instance Attribute Summary collapse
-
#elements ⇒ Object
readonly
Returns the value of attribute elements.
Instance Method Summary collapse
- #add(element) ⇒ Object
-
#initialize(elements = nil) ⇒ List
constructor
A new instance of List.
Methods inherited from Node
Constructor Details
#initialize(elements = nil) ⇒ List
Returns a new instance of List.
4 5 6 |
# File 'lib/ruby_cop/ruby/list.rb', line 4 def initialize(elements=nil) @elements = Array(elements).compact # TODO: compact might cause problems here end |
Instance Attribute Details
#elements ⇒ Object (readonly)
Returns the value of attribute elements.
8 9 10 |
# File 'lib/ruby_cop/ruby/list.rb', line 8 def elements @elements end |
Instance Method Details
#add(element) ⇒ Object
10 11 12 |
# File 'lib/ruby_cop/ruby/list.rb', line 10 def add(element) @elements.push(element) end |