Class: ThumbnailSpec::EditSpec
- Inherits:
-
Object
- Object
- ThumbnailSpec::EditSpec
- Defined in:
- lib/httpthumbnailer/thumbnail_specs.rb
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, args, options = {}) ⇒ EditSpec
constructor
A new instance of EditSpec.
- #to_s ⇒ Object
Constructor Details
#initialize(name, args, options = {}) ⇒ EditSpec
Returns a new instance of EditSpec.
82 83 84 85 86 87 88 |
# File 'lib/httpthumbnailer/thumbnail_specs.rb', line 82 def initialize(name, args, = {}) name.nil? or name.empty? and raise MissingArgumentError, 'edit name' @name = name @args = args @options = end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
67 68 69 |
# File 'lib/httpthumbnailer/thumbnail_specs.rb', line 67 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
67 68 69 |
# File 'lib/httpthumbnailer/thumbnail_specs.rb', line 67 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
67 68 69 |
# File 'lib/httpthumbnailer/thumbnail_specs.rb', line 67 def @options end |
Class Method Details
.from_string(string) ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/httpthumbnailer/thumbnail_specs.rb', line 69 def self.from_string(string) args = ThumbnailSpec.split_args(string) args, = ThumbnailSpec.(args) name = args.shift begin = ThumbnailSpec.() rescue InvalidFormatError => error raise error.for_edit(name) end new(name, args, ) end |
Instance Method Details
#to_s ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/httpthumbnailer/thumbnail_specs.rb', line 90 def to_s begin [@name, *@args, *ThumbnailSpec.(@options)].join(',') rescue InvalidFormatError => error raise error.for_edit(name) end end |