Sha256: 4b3e1e0dbc07df64f5d52ff154120c689caf5f44a6e66722145f2781b40bfb79
Contents?: true
Size: 2 KB
Versions: 1
Compression:
Stored size: 2 KB
Contents
require 'vstudioide/core_ext/string' require 'vstudioide/sln_node_mixins' module VStudioIDE class SLNNode end class SLNGlobalNode < SLNNode def initialize(io) @sections = [] parse io end def [](arg) return @sections[arg] if arg.is_a? Fixnum @sections.each { |s| return s if s.type == arg } nil end private def parse(io) while io.gets $_.strip! break if $_ == "EndGlobal" if $_.begin? "GlobalSection" @sections << SLNGlobalSectionNode.new($_, io) end end end end class SLNGlobalSectionNode < SLNNode include SLNNodeMixin::TypedNode def initialize(line, io) @children = [] parse line, io end def each @children.each { |c| yield c } end private def parse(line, io) line.slice!(0, "GlobalSection".length) super while io.gets $_.strip! break if $_ == "EndGlobalSection" @children << $_ end end end class SLNProjectNode < SLNNode include SLNNodeMixin::TypedNode def initialize(line, io) @sections = [] parse line, io end private def parse(line, io) line.slice!(0, "Project".length) super while io.gets $_.strip! break if $_ == "EndProject" if $_.begin? "ProjectSection" @sections << SLNProjectSectionNode.new($_, io) end end end end class SLNProjectSectionNode < SLNNode include SLNNodeMixin::TypedNode def initialize(line, io) @children = [] parse line, io end private def parse(line, io) line.slice!(0, "ProjectSection".length) super while io.gets $_.strip! break if $_ == "EndProjectSection" @children << $_ end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vstudioide-0.1.0 | lib/vstudioide/sln_node.rb |