Sha256: e30c03ac6ec1cd18b5959b65310cf3225d3c3ba0e6bdf75c50628267adfb8f69

Contents?: true

Size: 830 Bytes

Versions: 3

Compression:

Stored size: 830 Bytes

Contents

module SimpleView

	class SimpleViewIO < SimpleViewBase			
		EXTENTION = ".io.rb".freeze unless defined?(EXTENTION)

		def self.extension
			EXTENTION
		end

		SimpleViewBase.register(self)

		def do_rendering(rendable_object, options)
			options = {:target => $stdout}.merge(options)
			filename = options.delete(:filename) || '<IO>'
			line = options.delete(:line) || 1
			io = options[:target]
			rendable_object.put_locals_objects((options.delete(:io_name) || :io).to_sym => io)
			render_with_helper(rendable_object) do
				eval self.template_content, rendable_object.get_binding, filename, line
			end				
		end

	end
	
	module Renderable

		module InstanceMethods		

			def render_io(template, options = {})				
				render_with SimpleViewIO, template, options
			end
		
		end
	
	end

end

Version data entries

3 entries across 2 versions & 1 rubygems

Version Path
simple_view-0.0.2 lib/simple_view/io_view.rb
simple_view-0.0.1 lib/simple_view/CVS/RevisionCache/io_view.rb#1.1.1.1
simple_view-0.0.1 lib/simple_view/io_view.rb