Renamed on_begin to on_followed_by
This commit is contained in:
parent
c98ba21a87
commit
92b43a7500
|
@ -16,13 +16,9 @@ module Oga
|
|||
send(:"on_#{ast.type}", ast)
|
||||
end
|
||||
|
||||
##
|
||||
# Processes a "begin" node.
|
||||
#
|
||||
# @param [Oga::Ruby::Node] ast
|
||||
# @return [String]
|
||||
#
|
||||
def on_begin(ast)
|
||||
def on_followed_by(ast)
|
||||
ast.to_a.map { |child| process(child) }.join("\n\n")
|
||||
end
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ module Oga
|
|||
# @return [Oga::Ruby::Node]
|
||||
#
|
||||
def followed_by(other)
|
||||
Node.new(:begin, [self, other])
|
||||
Node.new(:followed_by, [self, other])
|
||||
end
|
||||
|
||||
##
|
||||
|
|
|
@ -5,13 +5,13 @@ describe Oga::Ruby::Generator do
|
|||
@generator = described_class.new
|
||||
end
|
||||
|
||||
describe '#on_begin' do
|
||||
describe '#on_followed_by' do
|
||||
it 'returns a String' do
|
||||
node1 = Oga::Ruby::Node.new(:lit, %w{10})
|
||||
node2 = Oga::Ruby::Node.new(:lit, %w{20})
|
||||
joined = node1.followed_by(node2)
|
||||
|
||||
@generator.on_begin(joined).should == "10\n\n20"
|
||||
@generator.on_followed_by(joined).should == "10\n\n20"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ describe Oga::Ruby::Node do
|
|||
node2 = described_class.new(:lit, %w{B})
|
||||
joined = node1.followed_by(node2)
|
||||
|
||||
joined.type.should == :begin
|
||||
joined.type.should == :followed_by
|
||||
joined.to_a.should == [node1, node2]
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue