Sha256: 9e096a3bfff596e61dc7b03abcd06bc03aed0a5b178dda4dea275c0e27ef29d9

Contents?: true

Size: 1.17 KB

Versions: 2

Compression:

Stored size: 1.17 KB

Contents

module Zena
  module Use
    module ZafuSafeDefinitions
      class ParamsDictionary
        include RubyLess
        safe_method ['[]', Symbol] => {:class => String, :nil => true}
      end

      module ViewMethods
        include RubyLess
        safe_method :params => ParamsDictionary
        safe_method :now    => {:method => 'Time.now', :class => Time}
        safe_method_for String, [:gsub, Regexp, String] => {:class => String, :pre_processor => true}
        safe_method_for String, :upcase => {:class => String, :pre_processor => true}
        safe_method_for Object, :blank? => Boolean

        safe_method_for Node, [:kind_of?, String] => {:method => 'kpath_match?', :class => Boolean}
        safe_method_for Node, [:kind_of?, Number] => {:method => 'has_role?',    :class => Boolean}
      end # ViewMethods


      module ZafuMethods

        def safe_const_type(class_name)
          if klass = get_class(class_name)
            {:method => "'#{klass.kpath}'", :class => String}
          elsif role = Node.get_role(class_name)
            {:method => role.id.to_s, :class => Number}
          else
            nil
          end
        end
      end # ZafuMethods
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
zena-1.0.0.beta2 lib/zena/use/zafu_safe_definitions.rb
zena-1.0.0.beta1 lib/zena/use/zafu_safe_definitions.rb