Added Ruby generator support for Symbols
This commit is contained in:
parent
05a57a807e
commit
6f6151fd52
|
@ -172,6 +172,16 @@ end
|
||||||
ast.to_a[0].inspect
|
ast.to_a[0].inspect
|
||||||
end
|
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.
|
# Processes a literal node.
|
||||||
#
|
#
|
||||||
|
|
|
@ -154,6 +154,14 @@ end
|
||||||
end
|
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
|
describe '#on_lit' do
|
||||||
it 'returns a String' do
|
it 'returns a String' do
|
||||||
node = Oga::Ruby::Node.new(:lit, %w{foo})
|
node = Oga::Ruby::Node.new(:lit, %w{foo})
|
||||||
|
|
Loading…
Reference in New Issue