Module: Innate::Helper::Aspect::SingletonMethods

### Home Classes Methods

### In Files

- lib/innate/helper/aspect.rb

### Methods

- #add_action_wrapper
- #after
- #after_all
- #before
- #before_all
- #wrap

### Included Modules

- Innate::Traited

### Class/Module Index

Quicksearch

- Innate
- Innate::Action
- Innate::Adapter
- Innate::Cache
- Innate::Cache::API
- Innate::Cache::DRb
- Innate::Cache::FileBased
- Innate::Cache::Marshal
- Innate::Cache::Memory
- Innate::Cache::YAML
- Innate::Current
- Innate::Etanni
- Innate::Helper
- Innate::Helper::Aspect
- Innate::Helper::Aspect::SingletonMethods
- Innate::Helper::CGI
- Innate::Helper::Flash
- Innate::Helper::Link
- Innate::Helper::Redirect
- Innate::Helper::Render
- Innate::HelperAccess
- Innate::HelpersHelper
- Innate::LRUHash
- Innate::LogHub
- Innate::Mock
- Innate::Mock::Session
- Innate::Node
- Innate::Optioned
- Innate::Optioned::SingletonMethods
- Innate::Options
- Innate::Request
- Innate::Response
- Innate::Rewrite
- Innate::Route
- Innate::Session
- Innate::Session::Flash
- Innate::SingletonMethods
- Innate::StateAccessor
- Innate::Traited
- Innate::Trinity
- Innate::URLMap
- Innate::View
- Innate::View::ERB
- Innate::View::Etanni
- Innate::View::None
- Logger
- Logger::ColorFormatter
- Object

No matching classes.

# Innate::Helper::Aspect::SingletonMethods

Module containing various methods that will be made available as class methods to the class that included {Innate::Helper::Aspect}.

### Public Instance Methods

add_action_wrapper(order, method_name) click to toggle source

    # File lib/innate/helper/aspect.rb, line 282
    def add_action_wrapper(order, method_name)
      if wrap = trait[:wrap]
        wrap.merge(SortedSet[[order, method_name.to_s]])
      else
        trait :wrap => SortedSet[[order, method_name.to_s]]
      end
    end

after(*names, &block) click to toggle source

Hook that is called after a specific list of actions.

@example

    class MainController
      include Innate::Node

      map '/'

      helper :aspect

      after(:index, :other) do
        puts 'Executed after specific actions only.'
      end

      def index
        return 'Hello, Innate!'
      end

      def other
        return 'Other method'
      end
    end

    # File lib/innate/helper/aspect.rb, line 248
    def after(*names, &block)
      names.each{|name| AOP[self][:after][name] = block }
    end

after_all(&block) click to toggle source

Hook that is called after all the actions in a node.

@example

    class MainController
      include Innate::Node

      map '/'

      helper :aspect

      after_all do
        puts 'Executed after all actions'
      end

      def index
        return 'Hello, Innate!'
      end
    end

    # File lib/innate/helper/aspect.rb, line 220
    def after_all(&block)
      AOP[self][:after_all] = block
    end

before(*names, &block) click to toggle source

Hook that is called before a specific list of actions.

@example

    class MainController
      include Innate::Node

      map '/'

      helper :aspect

      before(:index, :other) do
        puts 'Executed before specific actions only.'
      end

      def index
        return 'Hello, Innate!'
      end

      def other
        return 'Other method'
      end
    end

    # File lib/innate/helper/aspect.rb, line 196
    def before(*names, &block)
      names.each{|name| AOP[self][:before][name] = block }
    end

before_all(&block) click to toggle source

Hook that is called before all the actions in a node.

@example

    class MainController
      include Innate::Node

      map '/'

      helper :aspect

      before_all do
        puts 'Executed before all actions'
      end

      def index
        return 'Hello, Innate!'
      end
    end

    # File lib/innate/helper/aspect.rb, line 168
    def before_all(&block)
      AOP[self][:before_all] = block
    end

wrap(*names, &block) click to toggle source

Wraps the block around the list of actions resulting in the block being called both before and after each action.

@example

    class MainController
      include Innate::Node

      map '/'

      helper :aspect

      wrap(:index) do
        puts 'Wrapped around the index method'
      end

      def index
        return 'Hello, Innate!'
      end

      def other
        return 'Other method'
      end
    end

    # File lib/innate/helper/aspect.rb, line 277
    def wrap(*names, &block)
      before(*names, &block)
      after(*names, &block)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.