Class: Array

Inherits:
Object show all
Defined in:
lib/cfoo/array.rb,
lib/cfoo/parser.rb

Instance Method Summary collapse

Instance Method Details

#expand_elObject



46
47
48
# File 'lib/cfoo/parser.rb', line 46

def expand_el
    map {|element| element.expand_el }
end

#join_adjacent_stringsObject



2
3
4
5
6
7
8
9
10
11
12
# File 'lib/cfoo/array.rb', line 2

def join_adjacent_strings
    return clone if empty?
    self[1..-1].inject([first]) do |combined_parts, part|
        previous = combined_parts.pop
        if previous.class == String && part.class == String
            combined_parts << previous + part
        else
            combined_parts << previous << part
        end
    end
end