-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Serfs Decoders, rexml example, clean up, improved File suppor…
…t, commit prior to refactoring boostrap
- Loading branch information
Showing
39 changed files
with
442 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -1,13 +1,20 @@ | |||
.svn | |||
prebuild.bat | |||
postbuild.bat | |||
_ReSharper.IREmbeddedApp/* | _ReSharper.IREmbeddedApp/* | ||
ExampleApps/obj/ | ExampleApps/obj/ | ||
ExampleApps/bin/ | |||
IREmbeddedApp/bin/ | IREmbeddedApp/bin/ | ||
IREmbeddedApp/obj/ | IREmbeddedApp/obj/ | ||
IRTestResources/bin/ | IRTestResources/bin/ | ||
IRTestResources/obj/ | IRTestResources/obj/ | ||
IREmbeddedLibraries/bin/ | IREmbeddedLibraries/bin/ | ||
IREmbeddedLibraries/obj/ | IREmbeddedLibraries/obj/ | ||
IRSinatra/obj/ | IRSinatra/obj/ | ||
IRSinatra/bin/ | |||
IREmbeddedApp.4.5.resharper | IREmbeddedApp.4.5.resharper | ||
IREmbeddedApp.4.5.resharper.user | IREmbeddedApp.4.5.resharper.user | ||
**/Iron*.dll | **/Iron*.dll | ||
**/Micro*.dll | **/Micro*.dll | ||
**/*.pdb | |||
**/*.suo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,34 @@ | |||
# Sample code for reading embedded resource files | |||
|
|||
# SerfSupp.Debug = true | |||
|
|||
# File.stat support | |||
stat = File.stat("mydoc.xml") | |||
puts "File time: #{stat.mtime}" | |||
puts "File size: #{stat.size}" | |||
|
|||
# Read a file in text mode | |||
puts "Text mode:" | |||
f = File.new("mydoc.xml") | |||
p f.readline | |||
f.rewind | |||
p f.readline | |||
count = 1 | |||
until f.eof? | |||
count += 1 | |||
f.readline | |||
end | |||
puts "#{count} lines read" | |||
|
|||
# Read a file in binary mode | |||
puts "Binary mode:" | |||
f = File.new("mydoc.xml", 'rb') | |||
p f.readline | |||
f.rewind | |||
p f.readline | |||
count = 1 | |||
until f.eof? | |||
count += 1 | |||
f.readline | |||
end | |||
puts "#{count} lines read" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,26 @@ | |||
<inventory title="OmniCorp Store #45x10^3"> | |||
<section name="health"> | |||
<item upc="123456789" stock="12"> | |||
<name>Invisibility Cream</name> | |||
<price>14.50</price> | |||
<description>Makes you invisible</description> | |||
</item> | |||
<item upc="445322344" stock="18"> | |||
<name>Levitation Salve</name> | |||
<price>23.99</price> | |||
<description>Levitate yourself for up to 3 hours per application</description> | |||
</item> | |||
</section> | |||
<section name="food"> | |||
<item upc="485672034" stock="653"> | |||
<name>Blork and Freen Instameal</name> | |||
<price>4.95</price> | |||
<description>A tasty meal in a tablet; just add water</description> | |||
</item> | |||
<item upc="132957764" stock="44"> | |||
<name>Grob winglets</name> | |||
<price>3.56</price> | |||
<description>Tender winglets of Grob. Just add water</description> | |||
</item> | |||
</section> | |||
</inventory> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,33 @@ | |||
# Sample code from http://germane-software.com/software/rexml/docs/tutorial.html | |||
|
|||
require "rexml/document" | |||
include REXML | |||
|
|||
# Simple string load/write | |||
string = <<EOF | |||
<mydoc> | |||
<someelement attribute="nanoo">Text, text, text</someelement> | |||
</mydoc> | |||
EOF | |||
doc = Document.new(string) | |||
doc.write $stdout | |||
|
|||
doc = Document.new File.new("mydoc.xml") | |||
doc.elements.each("inventory/section") { |element| puts element.attributes["name"] } | |||
# -> health | |||
# -> food | |||
doc.elements.each("*/section/item") { |element| puts element.attributes["upc"] } | |||
# -> 123456789 | |||
# -> 445322344 | |||
# -> 485672034 | |||
# -> 132957764 | |||
root = doc.root | |||
puts root.attributes["title"] | |||
# -> OmniCorp Store #45x10^3 | |||
puts root.elements["section/item[@stock='44']"].attributes["upc"] | |||
# -> 132957764 | |||
puts root.elements["section"].attributes["name"] | |||
# -> health (returns the first encountered matching element) | |||
puts root.elements[1].attributes["name"] | |||
# -> health (returns the FIRST child element) | |||
root.detect {|node| node.kind_of? Element and node.attributes["name"] == "food" } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.