mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/psych/lib/psych/visitors/visitor.rb (initialize): push accessor
methods to subclass that actually uses them. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d5b2de3af1
commit
3d2e701396
3 changed files with 11 additions and 9 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Tue Nov 2 22:50:25 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
|
* ext/psych/lib/psych/visitors/visitor.rb (initialize): push accessor
|
||||||
|
methods to subclass that actually uses them.
|
||||||
|
|
||||||
Tue Nov 2 22:47:08 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
Tue Nov 2 22:47:08 2010 Aaron Patterson <aaron@tenderlovemaking.com>
|
||||||
|
|
||||||
* ext/psych/lib/psych/visitors/visitor.rb (accept): switch to
|
* ext/psych/lib/psych/visitors/visitor.rb (accept): switch to
|
||||||
|
|
|
@ -1,15 +1,6 @@
|
||||||
module Psych
|
module Psych
|
||||||
module Visitors
|
module Visitors
|
||||||
class Visitor
|
class Visitor
|
||||||
attr_reader :started, :finished
|
|
||||||
alias :finished? :finished
|
|
||||||
alias :started? :started
|
|
||||||
|
|
||||||
def initialize
|
|
||||||
@started = false
|
|
||||||
@finished = false
|
|
||||||
end
|
|
||||||
|
|
||||||
def accept target
|
def accept target
|
||||||
visit target
|
visit target
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,8 +8,14 @@ module Psych
|
||||||
# builder.tree # => #<Psych::Nodes::Stream .. }
|
# builder.tree # => #<Psych::Nodes::Stream .. }
|
||||||
#
|
#
|
||||||
class YAMLTree < Psych::Visitors::Visitor
|
class YAMLTree < Psych::Visitors::Visitor
|
||||||
|
attr_reader :started, :finished
|
||||||
|
alias :finished? :finished
|
||||||
|
alias :started? :started
|
||||||
|
|
||||||
def initialize options = {}, emitter = Psych::TreeBuilder.new
|
def initialize options = {}, emitter = Psych::TreeBuilder.new
|
||||||
super()
|
super()
|
||||||
|
@started = false
|
||||||
|
@finished = false
|
||||||
@emitter = emitter
|
@emitter = emitter
|
||||||
@st = {}
|
@st = {}
|
||||||
@ss = ScalarScanner.new
|
@ss = ScalarScanner.new
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue