### Home Classes Methods

### In Files

- lib/termtter/hook.rb

### Parent

Object

### Methods

- ::new
- #call
- #match?

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Termtter
- Termtter::API
- Termtter::ActiveRubytter
- Termtter::Client
- Termtter::Client::UserSearchEvent
- Termtter::Command
- Termtter::CommandLine
- Termtter::Config
- Termtter::ConfigSetup
- Termtter::Crypt
- Termtter::Event
- Termtter::HTTPpool
- Termtter::Hook
- Termtter::HookCanceled
- Termtter::Hookable
- Termtter::JSONError
- Termtter::MemoryCache
- Termtter::MemoryCache::MemCacheMock
- Termtter::OptParser
- Termtter::Plugin
- Termtter::Plugin::Screen
- Termtter::Plugins
- Termtter::Plugins::Haml
- Termtter::RubytterProxy
- Termtter::RubytterProxy::FrequentAccessError
- Termtter::RubytterProxy::LimitManager
- Termtter::Status
- Termtter::Storage
- Termtter::Storage::Status
- Termtter::Task
- Termtter::TaskManager
- Termtter::UserStreamReceiver
- OAuth
- OAuth::AccessToken
- Array
- Growl
- IRB
- Object
- Readline
- Status
- String
- Symbol
- TermColor
- User

No matching classes.

# Termtter::Hook

### Attributes

exec_proc[RW]
name[RW]
points[RW]

### Public Class Methods

new(args) click to toggle source

    # File lib/termtter/hook.rb, line 6
    def initialize(args)
      raise ArgumentError, ":name is not given." unless args.has_key?(:name)
      @name = args[:name].to_sym
      @points = args[:points] || [args[:point]].compact
      @exec_proc = args[:exec_proc] || args[:exec] || lambda {}
    end

### Public Instance Methods

call(*args) click to toggle source

    # File lib/termtter/hook.rb, line 26
    def call(*args)
      begin
        self.exec_proc.call(*args)
      rescue ArgumentError
        args.pop
        retry
      end
    end

match?(point) click to toggle source

    # File lib/termtter/hook.rb, line 13
    def match?(point)
      points.any? {|pt|
        case pt
        when String, Symbol
          pt.to_s == point.to_s
        when Regexp
          (pt =~ point.to_s) ? true : false
        else
          false
        end
      }
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.