Class: RScale::Format
- Inherits:
-
Object
- Object
- RScale::Format
- Defined in:
- lib/rscale/format.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#styles ⇒ Object
Returns the value of attribute styles.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(name) ⇒ Format
constructor
A new instance of Format.
-
#style(name, opts = {}) ⇒ Object
Add a new style.
Constructor Details
#initialize(name) ⇒ Format
Returns a new instance of Format.
6 7 8 9 10 |
# File 'lib/rscale/format.rb', line 6 def initialize(name) @name = name.to_s @styles = {} @url = '/:format/:style/:uuid_dir/:uuid.:extension' end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rscale/format.rb', line 3 def name @name end |
#styles ⇒ Object
Returns the value of attribute styles.
4 5 6 |
# File 'lib/rscale/format.rb', line 4 def styles @styles end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/rscale/format.rb', line 4 def url @url end |
Instance Method Details
#style(name, opts = {}) ⇒ Object
Add a new style
13 14 15 16 17 18 |
# File 'lib/rscale/format.rb', line 13 def style(name, opts={}) raise FormatError, 'Options required!' if opts.empty? raise FormatError, 'Options must be a Hash!' unless opts.kind_of?(Hash) opts[:style] = name @styles[name] = opts end |