lib/tram/policy/generator/policy.erb in tram-policy-0.0.1 vs lib/tram/policy/generator/policy.erb in tram-policy-0.0.2
- old
+ new
@@ -1,20 +1,27 @@
+# TODO: describe the policy, its subject and context
class <%= klass %> < Tram::Policy
+ # TODO: add default values (default: -> { ... }),
+ # coercers (type: proc(&:to_s)),
+ # and optional arguments (optional: true)
+ # when necessary
<% parsed_params.each do |param| -%>
param :<%= param %>
<% end -%>
<% parsed_options.each do |option| -%>
option :<%= option %>
<% end -%>
<% parsed_validators.each do |validator| -%>
- validate :<%= validator %>
+ validate :<%= validator[:name] %>
<% end -%>
private
<% parsed_validators.each do |validator| %>
- def <%= validator %>
- return if true # define a condition
- errors.add :<%= validator %> # add necessary tags
+ def <%= validator[:name] %>
+ # TODO: define a condition
+ return if true
+ # TODO: add necessary tags
+ errors.add :<%= validator[:key] %>
end
<% end -%>
end