Added Ruby generator support for Symbols

This commit is contained in:
Yorick Peterse 2015-07-12 23:11:14 +02:00
parent 05a57a807e
commit 6f6151fd52
2 changed files with 18 additions and 0 deletions

View File

@ -172,6 +172,16 @@ end
ast.to_a[0].inspect
end
##
# Processes a Symbol node.
#
# @param [Oga::Ruby::Node] ast
# @return [String]
#
def on_symbol(ast)
ast.to_a[0].to_sym.inspect
end
##
# Processes a literal node.
#

View File

@ -154,6 +154,14 @@ end
end
end
describe '#on_symbol' do
it 'returns a String' do
node = Oga::Ruby::Node.new(:symbol, [:foo])
@generator.on_symbol(node).should == ':foo'
end
end
describe '#on_lit' do
it 'returns a String' do
node = Oga::Ruby::Node.new(:lit, %w{foo})