/usr/lib/ruby/vendor_ruby/ramaze/helper/gestalt.rb is in ruby-ramaze 2012.12.08-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | require 'ramaze/gestalt'
module Ramaze
module Helper
# Gestalt is the custom HTML/XML builder for Ramaze, based on a very simple
# DSL it will build your markup.
module Gestalt
CACHE_G = {}
def gestalt(&block)
Ramaze::Gestalt.new(&block)
end
def build(&block)
Ramaze::Gestalt.build(&block)
end
def g(meth = nil, view = nil)
meth ||= caller[0].slice(/`(.*)'?/).gsub(/[\`\']/, '')
view_name = (self.class.to_s.sub('Controller', '') + 'View').split('::')
view ||= view_name.inject(Object){ |ns, name| ns.const_get(name) }
gestalt_class = CACHE_G[view] ||= g_class
gestalt = gestalt_class.new
gestalt.extend(view)
instance_variables.each do |iv|
gestalt.instance_variable_set(iv, instance_variable_get(iv))
end
gestalt.__send__(meth)
gestalt.to_s
end
def g_class
ancs = self.class.ancestors
helpers = Ramaze::Helper.constants.map{ |c| Ramaze::Helper.const_get(c)}
our_helpers = ancs & helpers
our_helpers.delete(Ramaze::Helper::Gestalt)
gestalt_class = Class.new(Ramaze::Gestalt){ include(*our_helpers) }
end
def method_missing(sym, *args, &block)
@gestalt ||= gestalt
@gestalt.send(sym, *args, &block)
end
end
end
end
module Ramaze::Helper::Link; undef :a end
|