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