Class: Configuration::Thumbnail::ThumbnailSpec::EditSpec

Inherits:
Object
  • Object
show all
Includes:
HandlerStatement::ConditionalInclusion
Defined in:
lib/httpimagestore/configuration/thumbnailer.rb

Instance Method Summary collapse

Methods included from HandlerStatement::ConditionalInclusion

#excluded?, grab_conditions_with_remaining, #included?, #with_conditions

Constructor Details

#initialize(name, args, options, edit_no) ⇒ EditSpec

Returns a new instance of EditSpec.



101
102
103
104
105
106
107
108
109
110
# File 'lib/httpimagestore/configuration/thumbnailer.rb', line 101

def initialize(name, args, options, edit_no)
	@name = name
	@args = args.map.with_index do |arg, arg_no|
		arg.to_template.with_missing_resolver{|locals, key| raise NoValueForSpecTemplatePlaceholderError.new(image_name, "edit #{edit_no + 1} argument #{arg_no + 1}", key, arg)}
	end

	@options = options.merge(options) do |option, old, template|
		template.to_template.with_missing_resolver{|locals, key| raise NoValueForSpecTemplatePlaceholderError.new(image_name, "edit #{edit_no + 1} option '#{option}' value", key, arg)}
	end
end

Instance Method Details

#render(request_state = {}) ⇒ Object



112
113
114
115
116
117
118
119
120
121
122
# File 'lib/httpimagestore/configuration/thumbnailer.rb', line 112

def render(request_state = {})
	args = @args.map.with_index do |arg, arg_no|
		arg.render(request_state)
	end

	options = @options.merge(@options) do |option, old, template|
		template.render(request_state)
	end

	HTTPThumbnailerClient::ThumbnailSpec::EditSpec.new(@name, args, options)
end