forked from randym/axlsx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added locking attributes for pictures and some stubs for parsing
- Loading branch information
Randy Morgan
committed
Dec 2, 2011
1 parent
6439ce4
commit 3def8f8
Showing
8 changed files
with
76 additions
and
15 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
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
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
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 | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
module Axlsx | ||
# The Parser module mixes in a number of methods to help in generating a model from xml | ||
module Parser | ||
attr_accessor :parser_xml | ||
|
||
def parse_string attr_name, xpath | ||
send("#{attr_name.to_s}=", parse_value(xpath)) | ||
end | ||
|
||
def parse_symbol attr_name, xpath | ||
v = parse_value xpath | ||
v = v.to_sym unless v.nil? | ||
send("#{attr_name.to_s}=", v) | ||
end | ||
|
||
def parse_integer attr_name, xpath | ||
v = parse_value xpath | ||
v = v.to_i if v.respond_to?(:to_i) | ||
send("#{attr_name.to_s}=", v) | ||
end | ||
|
||
def parse_float attr_name, xpath | ||
v = parse_value xpath | ||
v = v.to_f if v.respond_to?(:to_f) | ||
send("#{attr_name.to_s}=", v) | ||
end | ||
|
||
def parse_value xpath | ||
node = parser_xml.xpath(xpath) | ||
return nil if node.empty? | ||
node.text.strip | ||
end | ||
|
||
end | ||
end |
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