Sha256: d5cf814f51f2b0e23a7ad4cab5c113ff8a051daa12aedd538c3af6090f8df48b

Contents?: true

Size: 736 Bytes

Versions: 19

Compression:

Stored size: 736 Bytes

Contents

# 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[:name] %>
<% end -%>

  private
<% parsed_validators.each do |validator| %>
  def <%= validator[:name] %>
    # TODO: define a condition
    return if true
    # TODO: add necessary tags
    errors.add :<%= validator[:key] %>
  end
<% end -%>
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
tram-policy-2.2.0 lib/tram/policy/generator/policy.erb
tram-policy-2.1.0 lib/tram/policy/generator/policy.erb
tram-policy-2.0.1 lib/tram/policy/generator/policy.erb
tram-policy-2.0.0 lib/tram/policy/generator/policy.erb
tram-policy-1.0.1 lib/tram/policy/generator/policy.erb
tram-policy-1.0.0 lib/tram/policy/generator/policy.erb
tram-policy-0.4.0 lib/tram/policy/generator/policy.erb
tram-policy-0.3.1 lib/tram/policy/generator/policy.erb
tram-policy-0.3.0 lib/tram/policy/generator/policy.erb
tram-policy-0.2.5 lib/tram/policy/generator/policy.erb
tram-policy-0.2.4 lib/tram/policy/generator/policy.erb
tram-policy-0.2.3 lib/tram/policy/generator/policy.erb
tram-policy-0.2.2 lib/tram/policy/generator/policy.erb
tram-policy-0.2.1 lib/tram/policy/generator/policy.erb
tram-policy-0.2.0 lib/tram/policy/generator/policy.erb
tram-policy-0.1.1 lib/tram/policy/generator/policy.erb
tram-policy-0.1.0 lib/tram/policy/generator/policy.erb
tram-policy-0.0.3 lib/tram/policy/generator/policy.erb
tram-policy-0.0.2 lib/tram/policy/generator/policy.erb