Class: Xmlss::Writer::AttrsHash

Inherits:
Object
  • Object
show all
Defined in:
lib/xmlss/writer.rb

Overview

utility classes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAttrsHash

Returns a new instance of AttrsHash.



197
198
199
# File 'lib/xmlss/writer.rb', line 197

def initialize
  @raw = Hash.new
end

Instance Attribute Details

#rawObject (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