class Acl9::Dsl::Generators::BooleanMethod

Public Instance Methods

install_on(controller_class, opts) click to toggle source
# File lib/acl9/controller_extensions/generators.rb, line 122
def install_on(controller_class, opts)
  debug_dump(controller_class) if opts[:debug]

  _add_method(controller_class)

  if opts[:helper]
    controller_class.send(:helper_method, @method_name)
  end
end

Protected Instance Methods

_object_ref(object) click to toggle source
# File lib/acl9/controller_extensions/generators.rb, line 150
def _object_ref(object)
  "(options[:#{object}] || #{super})"
end
to_method_code() click to toggle source
# File lib/acl9/controller_extensions/generators.rb, line 134
        def to_method_code
          <<-RUBY
            def #{@method_name}(*args)
              options = args.extract_options!

              unless args.size <= 1
                raise ArgumentError, "call #{@method_name} with 0, 1 or 2 arguments"
              end

              self.action_name = args.first.to_s if args.present?

              return #{allowance_expression}
            end
          RUBY
        end