I have recently started using Ruby and would like to hear your take on the following piece of code.
class Generator
def initialize
@context = nil
end
def start(params)
@context = Context.new params
image = create_image
if cache_update_request?
upload image
end
return image
end
def create_image
composer = Composer.new @context
execution_context = ExecutionContext.new(@context, composer)
execution_context.render
end
def upload(image)
uploader = CompositorCommons::CacheUpdater.new
filename = @context.parameters[:cache]
location = 'dual/' + filname
type = 'image/jpeg'
uploader.upload(image,location,type)
end
def cache_update_request?
@context.parameters.has_key?(:cache)
end
end