Permalink
Browse files

Merge branch 'feature/jruby' into develop

  • Loading branch information...
2 parents f19a112 + 3c3ce57 commit 8634dbde9f441bc9126c7aa3e01d3cdef38cf5d9 @benlangfeld benlangfeld committed Dec 19, 2012
View
@@ -1,4 +1,4 @@
-guard 'rspec', :version => 2, :cli => '--format documentation' do
+guard 'rspec', :cli => '--format documentation' do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec/" }
@@ -55,7 +55,7 @@ def new(atts = {}, &block)
super(self.registered_name, nil, self.namespace) do |new_node|
(self.defaults || {}).merge(atts).each_pair { |k, v| new_node.send :"#{k}=", v }
block_return = new_node.eval_dsl_block &block
- new_node << block_return if block_return.is_a?(String)
+ new_node.string block_return if block_return.is_a?(String) && block_return.present?
end
end
end
@@ -83,7 +83,7 @@ def version=(other)
# @return [String] the base URI to which relative URLs are resolved
#
def base_uri
- read_attr :base
+ read_attr 'xml:base'
end
##
@@ -93,12 +93,6 @@ def base_uri=(uri)
self['xml:base'] = uri
end
- def to_doc
- Nokogiri::XML::Document.new.tap do |doc|
- doc << self
- end
- end
-
def +(other)
self.class.new(:base_uri => base_uri).tap do |new_element|
(self.children + other.children).each do |child|
@@ -147,13 +141,7 @@ def embed(other)
end
def string(other)
- self << other
- end
-
- def <<(other)
- other = encode_special_chars other if other.is_a? String
- super other
- self
+ self << Nokogiri::XML::Text.new(other, document)
end
def method_missing(method_name, *args, &block)
@@ -17,6 +17,8 @@ def self.module
alias_method :nokogiri_children, :children
+ alias :to_doc :document
+
include GenericElement
def regexp_content # :nodoc:
@@ -16,6 +16,8 @@ def self.module
end
include GenericElement
+
+ alias :to_doc :document
end # Element
end # SSML
end # RubySpeech
@@ -2,7 +2,7 @@ module RubySpeech
module XML
module Language
def language
- read_attr :lang
+ self['xml:lang']
end
def language=(l)
View
@@ -18,7 +18,8 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
- s.add_runtime_dependency %q<niceogiri>, ["~> 1.0"]
+ s.add_runtime_dependency %q<niceogiri>, ["~> 1.1", ">= 1.1.1"]
+ s.add_runtime_dependency %q<nokogiri>, ["~> 1.5", ">= 1.5.6"]
s.add_runtime_dependency %q<activesupport>, [">= 3.0.7"]
s.add_development_dependency %q<bundler>, [">= 1.0.0"]
@@ -122,14 +122,8 @@ module GRXML
end
describe "#to_doc" do
- let(:expected_doc) do
- Nokogiri::XML::Document.new.tap do |doc|
- doc << Grammar.new
- end
- end
-
it "should create an XML document from the grammar" do
- Grammar.new.to_doc.to_s.should == expected_doc.to_s
+ subject.to_doc.should == subject.document
end
end
@@ -195,7 +195,7 @@ def foo
end
expected_doc = GRXML::Grammar.new
3.times do
- expected_doc << GRXML::Rule.new(:content => "I <3 nachos.")
+ expected_doc << GRXML::Rule.new(:native_content => "I <3 nachos.")
end
doc.should == expected_doc
end
@@ -140,14 +140,8 @@ module SSML
end
describe "#to_doc" do
- let(:expected_doc) do
- Nokogiri::XML::Document.new.tap do |doc|
- doc << Speak.new
- end
- end
-
- it "should create an XML document from the speak" do
- Speak.new.to_doc.to_s.should == expected_doc.to_s
+ it "should create an XML document from the grammar" do
+ subject.to_doc.should == subject.document
end
end
@@ -154,7 +154,7 @@ def foo
end
expected_doc = SSML::Speak.new
2.times do
- expected_doc << SSML::Voice.new(:content => "I <3 nachos.")
+ expected_doc << SSML::Voice.new(:native_content => "I <3 nachos.")
end
doc.should == expected_doc
end
View
@@ -18,7 +18,7 @@ def subject=(s)
@subject = s
else
doc = Nokogiri::XML::Document.new
- doc << s
+ doc << s.to_xml
@subject = doc
end
end

0 comments on commit 8634dbd

Please sign in to comment.