Module: Spider::ControllerMixins::Visual::OutputFormatMethods

Defined in:
lib/spiderfw/controller/mixins/visual.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) default_output_format(format)



461
462
463
464
# File 'lib/spiderfw/controller/mixins/visual.rb', line 461

def default_output_format(format)
    @default_output_format = format if format
    @default_output_format
end

- (Object) output_format(method = nil, format = nil, params = {})



429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
# File 'lib/spiderfw/controller/mixins/visual.rb', line 429

def output_format(method=nil, format=nil, params={})
    return @default_output_format unless method
    @output_formats ||= {}
    @output_format_params ||= {}
    if format
        @output_formats[method] ||= []
        @output_formats[method] << format
        @output_format_params[method] ||= {}
        @output_format_params[method][format] = params
        controller_actions(method)
        return format
    end
    return @default_output_format unless @output_formats[method] && @output_formats[method][0]
    return @output_formats[method][0]
end

- (Boolean) output_format?(method, format)



449
450
451
452
# File 'lib/spiderfw/controller/mixins/visual.rb', line 449

def output_format?(method, format)
    return false unless @output_formats
    @output_formats[method] && @output_formats[method].include?(format)
end

- (Object) output_format_params(method, format)



454
455
456
457
458
459
# File 'lib/spiderfw/controller/mixins/visual.rb', line 454

def output_format_params(method, format)
    return nil unless @output_format_params && @output_format_params[method]
    fp = @output_format_params[method][format]
    return nil if fp == true
    return fp
end

- (Object) output_formats



445
446
447
# File 'lib/spiderfw/controller/mixins/visual.rb', line 445

def output_formats
    @output_formats || {}
end