Class: DummyImage::Parser
- Inherits:
-
Object
- Object
- DummyImage::Parser
- Defined in:
- lib/parser.rb
Instance Method Summary collapse
- #bgcolor ⇒ Object
- #fgcolor ⇒ Object
- #format ⇒ Object
- #height ⇒ Object
-
#initialize(path, options = {}) ⇒ Parser
constructor
A new instance of Parser.
- #path ⇒ Object
- #width ⇒ Object
Constructor Details
#initialize(path, options = {}) ⇒ Parser
Returns a new instance of Parser.
3 4 5 6 |
# File 'lib/parser.rb', line 3 def initialize path, = {} @path, @format = path.split ".", 2 @options = end |
Instance Method Details
#bgcolor ⇒ Object
32 33 34 |
# File 'lib/parser.rb', line 32 def bgcolor @bgcolor ||= valid_color(@options[:bgcolor]) || "000" end |
#fgcolor ⇒ Object
28 29 30 |
# File 'lib/parser.rb', line 28 def fgcolor @fgcolor ||= valid_color(@options[:fgcolor]) || "fff" end |
#format ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/parser.rb', line 8 def format if %w(png jpg jpeg gif).include? @format @format else "png" end end |
#height ⇒ Object
20 21 22 |
# File 'lib/parser.rb', line 20 def height @height ||= valid_size(@options[:height]) || "300" end |
#path ⇒ Object
16 17 18 |
# File 'lib/parser.rb', line 16 def path @path end |
#width ⇒ Object
24 25 26 |
# File 'lib/parser.rb', line 24 def width @width ||= valid_size(@options[:width]) || "300" end |