require "peto/mixin/peto_errorable" module Peto class <%= class_name %> extend PetoErrorable <%- each_procedures do |name, args| -%> def self.<%= name %>(<%= args.map{|arg| arg[:name]}.join(",") %>) <%- args.each do |arg| -%> invalid_type("<%= arg[:name] %>", <%= arg[:type] %>, <%= arg[:name] %>) unless <%= arg[:name] %>.class == <%= arg[:type] %> <%- end -%> raise_errors unless errors.empty? return { :procedure => "<%=name%>", :args => { <%- args.each do |arg| -%> :<%=arg[:name]%> => hashize(<%=arg[:name]%>), <%- end -%> } } end <%- end -%> def self.hashize(var) return var if [Fixnum, String].include?(var.class) var.to_hash end end end