Class: HTTPThumbnailerClient::ThumbnailSpec::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/httpthumbnailer-client/thumbnail_spec.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, width, height, format = 'jpeg', options = {}, &block) ⇒ Builder

Returns a new instance of Builder.



5
6
7
8
# File 'lib/httpthumbnailer-client/thumbnail_spec.rb', line 5

def initialize(method, width, height, format = 'jpeg', options = {}, &block)
	@spec = ThumbnailSpec.new(method, width.to_s, height.to_s, format, options)
	instance_eval(&block) if block
end

Instance Attribute Details

#specObject (readonly)

Returns the value of attribute spec.



25
26
27
# File 'lib/httpthumbnailer-client/thumbnail_spec.rb', line 25

def spec
  @spec
end

Instance Method Details

#edit(name, *args) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/httpthumbnailer-client/thumbnail_spec.rb', line 10

def edit(name, *args)
	edit_options, args = *args.partition{|e| e.kind_of? Hash}
	edit_options = edit_options.each.with_object({}) do |opt, hash|
		hash.merge! opt
	end

	edit_spec ThumbnailSpec::EditSpec.new(name, args, edit_options)
	self
end

#edit_spec(spec) ⇒ Object



20
21
22
23
# File 'lib/httpthumbnailer-client/thumbnail_spec.rb', line 20

def edit_spec(spec)
	@spec.edits << spec
	self
end

#to_sObject



27
28
29
# File 'lib/httpthumbnailer-client/thumbnail_spec.rb', line 27

def to_s
	@spec.to_s
end