### Home Classes Methods

### In Files

- lib/termtter/config.rb

### Parent

Object

### Methods

- ::new
- #__assign__
- #__clear__
- #__freeze__
- #__refer__
- #__unfreeze__
- #__values__
- #empty?
- #inspect
- #method_missing
- #set_assign_hook
- #set_default

### Files

- ChangeLog
- README.rdoc

### Class/Module Index

Quicksearch

- Termtter
- Termtter::API
- Termtter::ActiveRubytter
- Termtter::Client
- Termtter::Client::DirectMessage
- Termtter::Client::Jakigan
- Termtter::Client::SearchEvent
- Termtter::Client::UserSearchEvent
- Termtter::Command
- Termtter::CommandCanceled
- Termtter::CommandLine
- Termtter::CommandNotFound
- Termtter::Config
- Termtter::ConfigSetup
- Termtter::Crypt
- Termtter::English
- 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::Plugins::ListSwitch
- Termtter::RubytterProxy
- Termtter::RubytterProxy::FrequentAccessError
- Termtter::RubytterProxy::LimitManager
- Termtter::Status
- Termtter::StdOut
- Termtter::Storage
- Termtter::Storage::SQLite3
- Termtter::Storage::Status
- Termtter::Task
- Termtter::TaskManager
- Termtter::TypableIdGenerator
- Termtter::UserStreamReceiver
- Yharian
- Yharian::Alex
- Yharian::Jenifer
- Yharian::Remark
- Yharian::Speaker
- Yharian::Vicki
- Yharian::Yhara
- HatenaKeywordHaiku
- HatenaKeywordHaiku::Word
- OAuth
- OAuth::AccessToken
- Readline
- Readline::LIBREADLINE
- AAMaker
- Array
- BrowserNotFound
- Growl
- IRB
- Object
- Status
- String
- Symbol
- TermColor
- TermtterIrcGateway
- User

No matching classes.

# Termtter::Config

### Public Class Methods

new() click to toggle source

    # File lib/termtter/config.rb, line 6
    def initialize
      @store = Hash.new(:undefined)
      @freezes = Set.new
      @assign_hook = {}
    end

### Public Instance Methods

__assign__ :: Symbol → a → IO () click to toggle source

    # File lib/termtter/config.rb, line 62
    def __assign__(name, value)
      return if @freezes.include?(name)
      @store[name] = value
      @assign_hook[name].call(value) if @assign_hook[name]
      value
    end

__clear__(name = nil) click to toggle source

    # File lib/termtter/config.rb, line 79
    def __clear__(name = nil)
      return if name && @freezes.include?(name)
      if name
        @store[name] = :undefined
      else
        @store.clear
      end
    end

__freeze__(name) click to toggle source

    # File lib/termtter/config.rb, line 52
    def __freeze__(name)
      @freezes << name.to_sym
    end

__refer__ :: Symbol → IO a click to toggle source

    # File lib/termtter/config.rb, line 71
    def __refer__(name)
      @store[name] == :undefined ? @store[name] = Termtter::Config.new : @store[name]
    end

__unfreeze__(name) click to toggle source

    # File lib/termtter/config.rb, line 56
    def __unfreeze__(name)
      @freezes.delete(name.to_sym)
    end

__values__() click to toggle source

    # File lib/termtter/config.rb, line 75
    def __values__
      @store.dup
    end

empty? :: Boolean click to toggle source

    # File lib/termtter/config.rb, line 39
    def empty?
      @store.empty?
    end

inspect() click to toggle source

    # File lib/termtter/config.rb, line 12
    def inspect
      @store.inspect
    end

method_missing(name, *args) click to toggle source

    # File lib/termtter/config.rb, line 43
    def method_missing(name, *args)
      case name.to_s
      when /(.*)=$/
        __assign__($1.to_sym, args.first)
      else
        __refer__(name.to_sym)
      end
    end

set_assign_hook(name, &block) click to toggle source

    # File lib/termtter/config.rb, line 33
    def set_assign_hook(name, &block)
      @assign_hook[name.to_sym] = block
    end

set_default :: (Symbol | String) → a → IO () click to toggle source

    # File lib/termtter/config.rb, line 18
    def set_default(name, value)
      match_p, init, last = *name.to_s.match(/^(.+)\.([^\.]+)$/)
      if match_p
        tmp = eval(init)
        if tmp.__refer__(last.to_sym).empty?
          tmp.__assign__(last.to_sym, value)
        end
      else
        current_value = __refer__(name.to_sym)
        if current_value.kind_of?(self.class) && current_value.empty?
          __assign__(name.to_sym, value)
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.