Method: Effective::CodeReader#select
- Defined in:
- app/models/effective/code_reader.rb
#select(from: nil, to: nil, &block) ⇒ Object
Returns an array of stripped lines for each line where the passed block returns true
51 52 53 54 55 56 57 58 59 |
# File 'app/models/effective/code_reader.rb', line 51 def select(from: nil, to: nil, &block) retval = [] each_with_depth(from: from, to: to) do |line, depth, index| retval << line if (block_given? == false || block.call(line, depth, index)) end retval end |