### Home Classes Methods

### In Files

- lib/plugins/storage/status_mook.rb
- lib/plugins/storage/status.rb

### Parent

Object

### Methods

- ::all
- ::create
- ::insert
- ::new
- ::search
- ::search_user
- ::size

### 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::Storage::Status

### Constants

KEYS

### Public Class Methods

all() click to toggle source

    # File lib/plugins/storage/status_mook.rb, line 12
    def self.all
      []
    end

create() click to toggle source

    # File lib/plugins/storage/status_mook.rb, line 9
    def self.create
    end

insert(data) click to toggle source

    # File lib/plugins/storage/status.rb, line 67
    def self.insert(data)
      return unless data[:text]
      DB.instance.db.execute(
        "insert into post values(?,?,?,?,?,?)",
        data[:post_id],
        data[:created_at],
        data[:in_reply_to_status_id],
        data[:in_reply_to_user_id],
        data[:text],
        data[:user_id])
      DB.instance.db.execute(
        "insert into user values(?,?)",
        data[:user_id],
        data[:screen_name])
    rescue SQLite3::SQLException
    end

new() click to toggle source

    # File lib/plugins/storage/status_mook.rb, line 6
    def initialize
    end

search() click to toggle source

    # File lib/plugins/storage/status_mook.rb, line 16
    def self.search
    end

search_user(query) click to toggle source

    # File lib/plugins/storage/status.rb, line 43
    def self.search_user(query)
      raise "query must be Hash(#{query}, #{query.class})" unless query.kind_of? Hash
      result = []
      sql = "select created_at, screen_name, post_text, in_reply_to_status_id, post_id, user_id "
      sql += "from post inner join user on post.user_id = user.id where "
      sql += query[:user].split(' ').map!{|que| que.gsub(/(\w+)/, 'screen_name like \%\1%\')}.join(' or ')
      DB.instance.db.execute(sql) do |created_at, screen_name, post_text, in_reply_to_status_id, post_id, user_id|
        created_at = Time.at(created_at).to_s
        post_text.force_encoding('UTF-8') if post_text.respond_to?(:force_encoding)
        result << {
          :id => post_id,
          :created_at => created_at,
          :text => post_text,
          :in_reply_to_status_id => in_reply_to_status_id,
          :in_reply_to_user_id => nil,
          :user => {
            :id => user_id,
            :screen_name => screen_name
          }
        }
      end
      Rubytter.structize(result)
    end

size() click to toggle source

    # File lib/plugins/storage/status.rb, line 9
    def self.size
      DB.instance.db.get_first_value("select count(*) from post").to_i
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.