Class: SimplyInlineSvg::Storage
- Inherits:
-
Object
- Object
- SimplyInlineSvg::Storage
- Defined in:
- lib/simply_inline_svg/storage.rb
Class Attribute Summary collapse
-
.data ⇒ Object
Returns the value of attribute data.
Class Method Summary collapse
- .find(name) ⇒ Object
- .find!(name) ⇒ Object
- .register_directory(directory) ⇒ Object
- .register_svg(fname, fpath) ⇒ Object
Class Attribute Details
.data ⇒ Object
Returns the value of attribute data.
5 6 7 |
# File 'lib/simply_inline_svg/storage.rb', line 5 def data @data end |
Class Method Details
.find(name) ⇒ Object
26 27 28 |
# File 'lib/simply_inline_svg/storage.rb', line 26 def find(name) self.data[name] end |
.find!(name) ⇒ Object
21 22 23 24 |
# File 'lib/simply_inline_svg/storage.rb', line 21 def find!(name) raise SvgNotFound if self.data[name].nil? self.data[name] end |
.register_directory(directory) ⇒ Object
7 8 9 10 11 12 13 14 |
# File 'lib/simply_inline_svg/storage.rb', line 7 def register_directory(directory) fpaths = Dir["#{directory}/**/*.svg"] while fpaths.length > 0 fpath = fpaths.shift register_svg(File.basename(fpath), fpath) end self.data end |