Class: Xmlss::Writer::AttrsHash
- Inherits:
-
Object
- Object
- Xmlss::Writer::AttrsHash
- Defined in:
- lib/xmlss/writer.rb
Overview
utility classes
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #bool(k, v) ⇒ Object
-
#initialize ⇒ AttrsHash
constructor
A new instance of AttrsHash.
- #value(k, v) ⇒ Object
Constructor Details
#initialize ⇒ AttrsHash
197 198 199 |
# File 'lib/xmlss/writer.rb', line 197 def initialize @raw = Hash.new end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
195 196 197 |
# File 'lib/xmlss/writer.rb', line 195 def raw @raw end |
Instance Method Details
#bool(k, v) ⇒ Object
207 208 209 210 211 |
# File 'lib/xmlss/writer.rb', line 207 def bool(k, v) # write truthy values as '1', otherwise ignore @raw["#{Xmlss::Writer::SHEET_NS}:#{k}"] = 1 if v self end |
#value(k, v) ⇒ Object
201 202 203 204 205 |
# File 'lib/xmlss/writer.rb', line 201 def value(k, v) # ignore any nil-value or empty string attrs @raw["#{Xmlss::Writer::SHEET_NS}:#{k}"] = v if v && v != '' self end |