source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/message_window.rb
Ruby
mit
242
master
1,585
require 'twterm/subscriber' require 'twterm/event/message/abstract_message' module Twterm class MessageWindow include Subscriber # @param window [Curses::Window] def initialize(window) @window = window @queue = Queue.new subscribe(Event::Message::AbstractMessage) do |e| queue(...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/abstract_persistable_configuration.rb
Ruby
mit
242
master
2,919
module Twterm # @abstract class AbstractPersistableConfiguration # @param [Hash<Symbol, Object>] configuration A hash object to initialize configuration def initialize(configuration = {}) @configuration = configuration end # Gets a value associated to the given key. # @abstract def []...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/list.rb
Ruby
mit
242
master
1,197
module Twterm # A Twitter list class List # Unique ID of the list # # @return [Integer] attr_reader :id # @return [String] attr_reader :name # @return [String] attr_reader :slug # @return [String] attr_reader :full_name attr_reader :mode # @return [String] at...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/environment.rb
Ruby
mit
242
master
819
require 'terminal-notifier' module Twterm class Environment def initialize @uname = `uname`.strip @terminal_notifier_available = TerminalNotifier.available? @with_eog = system('which eog >/dev/null 2>&1') @with_imgcat = system('which imgcat >/dev/null 2>&1') @with_tmux = system('wh...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab_manager.rb
Ruby
mit
242
master
5,675
require 'twterm/publisher' require 'twterm/subscriber' require 'twterm/utils' require 'twterm/view' module Twterm class TabManager include Publisher include Subscriber include Utils DUMPED_TABS_FILE = "#{ENV['HOME']}/.twterm/dumped_tabs" def add(tab_to_add) check_type Tab::AbstractTab, ta...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/user.rb
Ruby
mit
242
master
1,147
module Twterm # A Twitter user class User attr_reader :description, :favorites_count, :followers_count, :friends_count, :id, :location, :name, :protected, :profile_image, :profile_background_image, :screen_name, :statuses_count, :url, :verified, :website alias_method :protect...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/screen.rb
Ruby
mit
242
master
3,999
require 'twterm/event/screen/refresh' require 'twterm/key_mapper' require 'twterm/subscriber' module Twterm class Screen include Subscriber # @todo Make private # @return [Curses::Window] attr_reader :tab_manager_window # @todo Make private # @return [Curses::Window] attr_reader :tab_wi...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/key_mapper.rb
Ruby
mit
242
master
3,584
require 'toml-rb' require 'singleton' require 'twterm/app' require 'twterm/key_mapper/abstract_key_mapper' require 'twterm/key_mapper/app_key_mapper' require 'twterm/key_mapper/cursor_key_mapper' require 'twterm/key_mapper/general_key_mapper.rb' require 'twterm/key_mapper/no_such_command' require 'twterm/key_mapper/no...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/search_query_window.rb
Ruby
mit
242
master
2,520
require 'twterm/subscriber' module Twterm class SearchQueryWindow include Subscriber class CancelInput < StandardError; end attr_reader :last_query # @param window [Curses::Window] def initialize(window) @window = window @searching_down = true @str = '' @last_query = ''...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image.rb
Ruby
mit
242
master
2,534
require 'twterm/image/between' require 'twterm/image/blank_line' require 'twterm/image/bold' require 'twterm/image/brackets' require 'twterm/image/color' require 'twterm/image/dim' require 'twterm/image/empty' require 'twterm/image/horizontal_sequential_image' require 'twterm/image/parens' require 'twterm/image/string_...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/persistable_configuration_proxy.rb
Ruby
mit
242
master
2,095
require 'toml-rb' module Twterm class PersistableConfigurationProxy # @param [Twterm::AbstractPersistableConfiguration] instance A configuration to persist # @param [String] filepath File path to persist the given configuration def initialize(instance, filepath) @instance = instance @filepath...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/photo_viewer.rb
Ruby
mit
242
master
930
require 'twterm/event/open_photo' require 'twterm/photo_viewer_backend/browser_backend' require 'twterm/photo_viewer_backend/imgcat_backend' require 'twterm/photo_viewer_backend/quick_look_backend' require 'twterm/subscriber' module Twterm class PhotoViewer include Subscriber # @param preferences [Twterm::P...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/uri_opener.rb
Ruby
mit
242
master
522
require 'launchy' require 'singleton' require 'twterm/event/open_uri' require 'twterm/publisher' require 'twterm/subscriber' require 'twterm/event/message/warning' module Twterm class URIOpener include Publisher include Singleton include Subscriber def initialize subscribe(Event::OpenURI) { |e...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/client.rb
Ruby
mit
242
master
1,098
require 'twterm/rest_client' module Twterm class Client include RESTClient attr_reader :user_id, :screen_name def initialize(user_id, screen_name, access_token, access_token_secret, repositories) @user_id, @screen_name = user_id, screen_name @access_token, @access_token_secret = access_toke...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/config.rb
Ruby
mit
242
master
650
module Twterm class Config def [](key) config[key] end def []=(key, value) return if config[key] == value config[key] = value save_config_to_file end private def config @config ||= exist_config_file? ? load_config_file : {} end def save_config_to_file...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/friendship.rb
Ruby
mit
242
master
730
module Twterm class Friendship STATUSES = %i( blocking following following_requested muting ).freeze attr_reader :status, :from, :to def initialize(status, from, to) fail ArgumentError, '`status` must be one of the following: :blocking, :follwing, :following_requested, ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/auth.rb
Ruby
mit
242
master
919
module Twterm module Auth def authenticate_user(config) consumer = OAuth::Consumer.new( 'vLNSVFgXclBJQJRZ7VLMxL9lA', 'OFLKzrepRG2p1hq0nUB9j2S9ndFQoNTPheTpmOY0GYw55jGgS5', site: 'https://api.twitter.com' ) request_token = consumer.get_request_token url = request_toke...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tweetbox.rb
Ruby
mit
242
master
3,506
require 'twterm/publisher' require 'twterm/event/message/error' require 'twterm/event/screen/refresh' module Twterm class Tweetbox class EmptyTextError < StandardError; end class TextTooLongError < StandardError def initialize(parse_result) @parse_result = parse_result end def mess...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/status.rb
Ruby
mit
242
master
2,717
require 'concurrent' require 'twterm/hashtag' class Twitter::Tweet attr_reader :quoted_status_id def initialize(*args) @quoted_status_id = args[0][:quoted_status_id] super end end module Twterm # A tweet class Status attr_reader :created_at, :favorite_count, :favorited, :hashtags, :id, :...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/view.rb
Ruby
mit
242
master
398
module Twterm class View def initialize(window, image) @window, @image = window, image end def at(line, column) @line, @column = line, column self end def render @image.at(line, column).render(@window) @window.refresh self end private def colum...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/publisher.rb
Ruby
mit
242
master
294
require 'twterm/event_dispatcher' require 'twterm/event/abstract_event' require 'twterm/utils' module Twterm module Publisher include Utils def publish(event) check_type Event::AbstractEvent, event EventDispatcher.instance.dispatch(event) event end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/rest_client.rb
Ruby
mit
242
master
11,252
require 'concurrent' require 'twterm/publisher' require 'twterm/event/message/success' module Twterm module RESTClient include Publisher CONSUMER_KEY = 'vLNSVFgXclBJQJRZ7VLMxL9lA'.freeze CONSUMER_SECRET = 'OFLKzrepRG2p1hq0nUB9j2S9ndFQoNTPheTpmOY0GYw55jGgS5'.freeze def add_list_member(list_id, user_...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/scheduler.rb
Ruby
mit
242
master
606
class Scheduler def initialize(interval, &block) fail ArgumentError, 'Interval must be a real number' unless interval.is_a?(Numeric) && interval.real? fail RangeError, 'Interval must be greater than zero' unless interval > 0 @interval, @block = interval, block @paused = false @thread = Thread.ne...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/color_manager.rb
Ruby
mit
242
master
1,390
module Twterm class ColorManager include Singleton COLORS = [:black, :white, :red, :green, :blue, :yellow, :cyan, :magenta, :transparent] CURSES_COLORS = { black: Curses::COLOR_BLACK, white: Curses::COLOR_WHITE, red: Curses::COLOR_RED, green: Curses::COLOR_GREEN, blue: Curse...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/completion_manager.rb
Ruby
mit
242
master
901
require 'twterm/completer/default_completer' require 'twterm/completer/screen_name_completer' require 'twterm/completer/search_query_completer' module Twterm class CompletionManager def initialize(app) @app = app Readline.completion_case_fold = false end def set_default_mode! complete...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/utils.rb
Ruby
mit
242
master
282
module Twterm module Utils module_function def check_type(expected_type, argument) return if argument.is_a?(expected_type) raise TypeError, 'TypeError: wrong argument type %s (expected %s)' % [ argument.class, expected_type ] end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/notification_dispatcher.rb
Ruby
mit
242
master
1,101
require 'twterm/event/notification/abstract_notification' require 'twterm/notification_backend/inline_backend' require 'twterm/notification_backend/terminal_notifier_backend' require 'twterm/notification_backend/tmux_backend' require 'twterm/subscriber' module Twterm class NotificationDispatcher include Subscrib...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/app.rb
Ruby
mit
242
master
4,855
require 'curses' require 'twterm/completion_manager' require 'twterm/environment' require 'twterm/event/screen/refresh' require 'twterm/message_window' require 'twterm/notification_dispatcher' require 'twterm/persistable_configuration_proxy' require 'twterm/preferences' require 'twterm/photo_viewer' require 'twterm/re...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/preferences.rb
Ruby
mit
242
master
1,852
require 'toml-rb' require 'twterm/abstract_persistable_configuration' module Twterm class Preferences < AbstractPersistableConfiguration def initialize(preferences) super(preferences) end # @param [Symbol] cat # @param [Symbol] key def [](cat, key) validate_key!(cat, key) con...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event_dispatcher.rb
Ruby
mit
242
master
1,458
require 'singleton' require 'twterm/utils' module Twterm class EventDispatcher include Singleton include Utils def initialize @subscriptions = [] end def dispatch(event) @subscriptions .select { |s| event.is_a?(s.event) } .map(&:callback) .each { |cb| cb.call...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/attr.rb
Ruby
mit
242
master
692
require 'twterm/image' class Twterm::Image::Attr < Twterm::Image # @param image [Twterm::Image] def initialize(image) super() @image = image end def height image.height end def render(window) image, attr = if image.is_a?(self.class) # fuse attributes when possible [image.im...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/empty.rb
Ruby
mit
242
master
233
module Twterm class Image class Empty < Twterm::Image def height 0 end def render(_) self end def to_s '' end def width 0 end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/parens.rb
Ruby
mit
242
master
318
require 'twterm/image/between' module Twterm class Image class Parens < Twterm::Image::Between def initialize(image) super(image, open, close) end private def open StringImage.new('(') end def close StringImage.new(')') end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/blank_line.rb
Ruby
mit
242
master
239
module Twterm class Image class BlankLine < Twterm::Image def height 1 end def render(_) self end def to_s "\n" end def width 0 end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/bold.rb
Ruby
mit
242
master
232
require 'twterm/image/attr' module Twterm class Image class Bold < Twterm::Image::Attr def to_s "\e[1m#{image}\e[0m" end protected def attr Curses::A_BOLD end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/string_image.rb
Ruby
mit
242
master
580
module Twterm class Image class StringImage < Twterm::Image def initialize(string) @string = string end def -(other) if other.is_a?(self.class) self.class.new(string + other.string) else super end end def height 1 en...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/between.rb
Ruby
mit
242
master
588
class Twterm::Image class Between < Twterm::Image def initialize(image, open, close) @image, @open, @close = image, open, close end def height 1 end def render(window) open.at(line, column).render(window) image.at(line, column + open.width).render(window) close.at(l...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/color.rb
Ruby
mit
242
master
851
require 'twterm/image/attr' module Twterm class Image class Color < Twterm::Image::Attr def initialize(image, fg, bg = :transparent) super(image) @fg, @bg = fg, bg end def to_s fg_colors = { black: 30, red: 31, green: 32, yellow: 33, blue: 34, magen...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/vertical_sequential_image.rb
Ruby
mit
242
master
738
module Twterm class Image class VerticalSequentialImage < Twterm::Image def initialize(images) @images = images end def |(other) append(other) end def append(image) images << image self end def height images.map(&:height).reduce(...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/brackets.rb
Ruby
mit
242
master
320
require 'twterm/image/between' module Twterm class Image class Brackets < Twterm::Image::Between def initialize(image) super(image, open, close) end private def open StringImage.new('[') end def close StringImage.new(']') end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/underlined.rb
Ruby
mit
242
master
243
require 'twterm/image/attr' module Twterm class Image class Underlined < Twterm::Image::Attr def to_s "\e[4m#{image}\e[0m" end protected def attr Curses::A_UNDERLINE end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/image/horizontal_sequential_image.rb
Ruby
mit
242
master
830
module Twterm class Image class HorizontalSequentialImage < Twterm::Image def initialize(images) @images = images end def -(other) append(other) end def append(image) if image.is_a?(self.class) @images += image.images else images ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/completer/screen_name_completer.rb
Ruby
mit
242
master
372
require 'twterm/completer/abstract_completer' module Twterm module Completer class ScreenNameCompleter < AbstractCompleter def complete(query) app.user_repository.all .map { |user| user.screen_name } .select { |name| name.start_with?(query) } end def completion_appe...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/completer/abstract_completer.rb
Ruby
mit
242
master
427
module Twterm module Completer class AbstractCompleter def initialize(app) @app = app end def basic_word_break_characters " \t\n\"\\'`$><=;|&{(" end def complete(_query) raise NotImplementedError, '`complete` method must be implemented' end def ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/completer/search_query_completer.rb
Ruby
mit
242
master
4,160
require 'twterm/completer/abstract_completer' module Twterm module Completer class SearchQueryCompleter < AbstractCompleter def completion_append_character '' end def complete(q) possible_operators = possible_operators_for_query(q) if q.empty? operators ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/completer/default_completer.rb
Ruby
mit
242
master
554
require 'twterm/completer/abstract_completer' module Twterm module Completer class DefaultCompleter < AbstractCompleter def complete(query) if query.start_with?('#') app.hashtag_repository.all .map { |tag| "##{tag.text}" } .select { |tag| tag.start_with?(query) } ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/searchable.rb
Ruby
mit
242
master
3,501
require 'twterm/event/message/info' require 'twterm/event/message/warning' require 'twterm/search_query_window' module Twterm module Tab module Searchable include Scrollable extend Forwardable def_delegators :scroller, :search_query def matches?(_item, _query) raise NotImplement...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/status_tab.rb
Ruby
mit
242
master
6,995
require 'addressable/uri' require 'twterm/event/open_photo' require 'twterm/event/open_uri' require 'twterm/hashtag' require 'twterm/image' require 'twterm/image_builder/user_name_image_builder' require 'twterm/publisher' require 'twterm/tab/abstract_tab' require 'twterm/tab/dumpable' require 'twterm/tab/loadable' req...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/dumpable.rb
Ruby
mit
242
master
409
module Twterm module Tab module Dumpable def dump fail NotImplementedError, 'dump method must be implemented' end def self.included(klass) klass.extend(ClassMethods) end module ClassMethods def recover(app, client, title, arg) tab = new(app, client...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/loadable.rb
Ruby
mit
242
master
300
module Twterm module Tab module Loadable def initialize(*) super @initially_loaded = false end def initially_loaded? @initially_loaded end def initially_loaded! @initially_loaded = true render end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/key_assignments_cheatsheet.rb
Ruby
mit
242
master
2,548
require 'twterm/image' require 'twterm/tab/abstract_tab' require 'twterm/tab/searchable' module Twterm module Tab class KeyAssignmentsCheatsheet < AbstractTab include Scrollable def ==(other) other.is_a?(self.class) end SHORTCUTS = { ['General', :general] => { ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/scrollable.rb
Ruby
mit
242
master
4,460
module Twterm module Tab module Scrollable extend Forwardable def_delegators :scroller, :current_item, :drawable_items def scroller return @scroller unless @scroller.nil? @scroller = self.class::Scroller.new(self) @scroller.delegate = self @scroller.after_move ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/user_tab.rb
Ruby
mit
242
master
9,660
require 'twterm/event/open_photo' require 'twterm/event/open_uri' require 'twterm/image_builder/user_name_image_builder' require 'twterm/publisher' require 'twterm/tab/abstract_tab' require 'twterm/tab/user_list_management' module Twterm module Tab class UserTab < AbstractTab include Dumpable include...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/abstract_tab.rb
Ruby
mit
242
master
2,910
require 'concurrent' require 'twterm/image' require 'twterm/subscriber' module Twterm module Tab class AbstractTab include Subscriber # @return [String] attr_reader :title # @param other [Twterm::Tab::AbstractTab] # # @return [Boolean] def ==(other) self.equal...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/rate_limit_status.rb
Ruby
mit
242
master
2,043
require 'twterm/tab/loadable' module Twterm module Tab class RateLimitStatus < AbstractTab include Loadable include Scrollable @@mutex = Mutex.new @@status = nil def initialize(app, client) super(app, client) scroller.set_no_cursor_mode! @ticker = Schedul...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/user_list_management.rb
Ruby
mit
242
master
2,745
require 'concurrent' require 'twterm/event/message/success' require 'twterm/image' require 'twterm/publisher' require 'twterm/tab/dumpable' require 'twterm/tab/loadable' require 'twterm/tab/searchable' module Twterm module Tab class UserListManagement < AbstractTab include Dumpable include Loadable ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/users/friends.rb
Ruby
mit
242
master
824
require 'twterm/tab/users/abstract_users_tab' module Twterm module Tab module Users class Friends < AbstractUsersTab include Dumpable attr_reader :user_id def dump user_id end def fetch client.friends(user_id) do |users| @user_ids.c...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/users/abstract_users_tab.rb
Ruby
mit
242
master
2,444
require 'concurrent' require 'twterm/event/user_garbage_collected' require 'twterm/image_builder/user_name_image_builder' require 'twterm/tab/abstract_tab' require 'twterm/tab/loadable' module Twterm module Tab module Users class AbstractUsersTab < AbstractTab include Loadable include Sear...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/users/followers.rb
Ruby
mit
242
master
828
require 'twterm/tab/users/abstract_users_tab' module Twterm module Tab module Users class Followers < AbstractUsersTab include Dumpable attr_reader :user_id def dump user_id end def fetch client.followers(user_id) do |users| @user_i...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/new/list.rb
Ruby
mit
242
master
2,147
require 'twterm/event/message/info' require 'twterm/tab/abstract_tab' require 'twterm/tab/loadable' module Twterm module Tab module New class List < AbstractTab include Loadable include Publisher include Searchable @@lists = nil def ==(other) other.is_a?(...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/new/user.rb
Ruby
mit
242
master
1,773
require 'twterm/event/message/error' require 'twterm/event/screen/refresh' require 'twterm/publisher' require 'twterm/tab/abstract_tab' module Twterm module Tab module New class User < AbstractTab include Publisher include Readline def ==(other) other.is_a?(self.class) ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/new/index.rb
Ruby
mit
242
master
3,065
require 'twterm/tab/abstract_tab' require 'twterm/tab/rate_limit_status' require 'twterm/tab/preferences/index' module Twterm module Tab module New class Index < AbstractTab include Scrollable def ==(other) other.is_a?(self.class) end def drawable_item_count ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/new/search.rb
Ruby
mit
242
master
3,014
require 'concurrent' require 'twterm/event/screen/refresh' require 'twterm/publisher' require 'twterm/tab/abstract_tab' require 'twterm/tab/loadable' module Twterm module Tab module New class Search < AbstractTab include Loadable include Publisher include Readline include S...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/conversation.rb
Ruby
mit
242
master
3,609
require 'concurrent' require 'twterm/tab/dumpable' require 'twterm/tab/statuses/abstract_statuses_tab' require 'twterm/tab/statuses/cacheable' module Twterm module Tab module Statuses class Conversation < AbstractStatusesTab include Cacheable include Dumpable attr_reader :status_i...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/abstract_statuses_tab.rb
Ruby
mit
242
master
8,069
require 'concurrent' require 'twterm/event/open_uri' require 'twterm/event/status_deleted' require 'twterm/event/status_garbage_collected' require 'twterm/image_builder/user_name_image_builder' require 'twterm/publisher' require 'twterm/subscriber' require 'twterm/tab/abstract_tab' require 'twterm/tab/loadable' requir...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/favorites.rb
Ruby
mit
242
master
911
require 'twterm/tab/statuses/abstract_statuses_tab' module Twterm module Tab module Statuses class Favorites < AbstractStatusesTab include Dumpable attr_reader :user, :user_id def ==(other) other.is_a?(self.class) && user_id == other.user_id end def dump...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/cacheable.rb
Ruby
mit
242
master
367
module Twterm module Tab module Statuses module Cacheable def retrieve_from_cache! statuses = cached_statuses cached_statuses.each { |status| append(status) } unless statuses.empty? sort scroller.move_to_top initially_loaded! ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/mentions.rb
Ruby
mit
242
master
885
require 'twterm/tab/statuses/abstract_statuses_tab' require 'twterm/event/status/mention' module Twterm module Tab module Statuses class Mentions < AbstractStatusesTab include Subscriber def close fail NotClosableError end def fetch client.mentions ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/home.rb
Ruby
mit
242
master
686
require 'twterm/subscriber' require 'twterm/tab/statuses/abstract_statuses_tab' require 'twterm/utils' module Twterm module Tab module Statuses class Home < AbstractStatusesTab include Subscriber include Utils def close fail NotClosableError end def fetch...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/list_timeline.rb
Ruby
mit
242
master
1,022
require 'twterm/tab/statuses/abstract_statuses_tab' module Twterm module Tab module Statuses class ListTimeline < AbstractStatusesTab include Dumpable attr_reader :list_id def initialize(app, client, list_id) super(app, client) @list_id = list_id se...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/search.rb
Ruby
mit
242
master
827
require 'twterm/tab/statuses/abstract_statuses_tab' module Twterm module Tab module Statuses class Search < AbstractStatusesTab include Dumpable attr_reader :query def ==(other) other.is_a?(self.class) && query == other.query end def close @aut...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/statuses/user_timeline.rb
Ruby
mit
242
master
1,311
require 'twterm/tab/statuses/abstract_statuses_tab' require 'twterm/tab/statuses/cacheable' module Twterm module Tab module Statuses class UserTimeline < AbstractStatusesTab include Cacheable include Dumpable attr_reader :user, :user_id def ==(other) other.is_a?(...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/preferences/photo_viewer_backend.rb
Ruby
mit
242
master
2,232
require 'twterm/image' require 'twterm/preferences' require 'twterm/publisher' require 'twterm/tab/abstract_tab' require 'twterm/tab/scrollable' module Twterm module Tab module Preferences class PhotoViewerBackend < AbstractTab include Scrollable include Publisher def drawable_item...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/preferences/index.rb
Ruby
mit
242
master
2,142
require 'twterm/image' require 'twterm/tab/preferences/control' require 'twterm/tab/preferences/notification_backend' require 'twterm/tab/preferences/photo_viewer_backend' require 'twterm/preferences' require 'twterm/publisher' require 'twterm/tab/abstract_tab' require 'twterm/tab/scrollable' module Twterm module Ta...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/preferences/control.rb
Ruby
mit
242
master
1,826
require 'twterm/image' require 'twterm/preferences' require 'twterm/publisher' require 'twterm/tab/abstract_tab' require 'twterm/tab/scrollable' module Twterm module Tab module Preferences class Control < AbstractTab include Scrollable include Publisher def drawable_item_count ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/tab/preferences/notification_backend.rb
Ruby
mit
242
master
2,265
require 'twterm/image' require 'twterm/preferences' require 'twterm/publisher' require 'twterm/tab/abstract_tab' require 'twterm/tab/scrollable' module Twterm module Tab module Preferences class NotificationBackend < AbstractTab include Scrollable include Publisher def drawable_ite...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/extensions/string.rb
Ruby
mit
242
master
503
class String def width each_char.map { |c| c.bytesize == 1 ? 1 : 2 }.reduce(0, &:+) end def split_by_width(width) cnt = 0 str = '' chunks = [] each_char do |c| if c == "\n" chunks << str str = '' cnt = 0 next end cnt += c.width if cnt ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/extensions/enumerator/lazy.rb
Ruby
mit
242
master
390
class Enumerator class Lazy def scan(initial, sym = nil) acc = initial @_scan_has_yielded_initial_value = false Enumerator::Lazy.new(self) do |y, x| y << initial && @_scan_has_yielded_initial_value = true unless @_scan_has_yielded_initial_value acc = sym.nil? ? yield(acc, x) : ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/extensions/curses/window.rb
Ruby
mit
242
master
369
class Curses::Window def bold(&block) attron(Curses::A_BOLD) block.call attroff(Curses::A_BOLD) end def with_color(fg, bg = :transparent, &block) color_pair_index = Twterm::ColorManager.instance.get_color_pair_index(fg, bg) attron(Curses.color_pair(color_pair_index)) block.call attrof...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/open_photo.rb
Ruby
mit
242
master
204
require 'twitter' require 'twterm/event/abstract_event' module Twterm module Event class OpenPhoto < AbstractEvent def fields { photo: Addressable::URI } end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/status_garbage_collected.rb
Ruby
mit
242
master
204
require 'twterm/event/abstract_event' module Twterm module Event class StatusGarbageCollected < AbstractEvent def fields { id: Integer } end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/abstract_event.rb
Ruby
mit
242
master
406
require 'twterm/utils' module Twterm module Event class AbstractEvent include Utils def initialize(*args) fields.zip(args).map(&:flatten).each do |name, type, value| check_type type, value instance_variable_set('@%s' % name, value) self.class.send(:attr_reader,...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/user_garbage_collected.rb
Ruby
mit
242
master
202
require 'twterm/event/abstract_event' module Twterm module Event class UserGarbageCollected < AbstractEvent def fields { id: Integer } end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/message/abstract_message.rb
Ruby
mit
242
master
382
require 'twterm/event/abstract_event' module Twterm module Event module Message class AbstractMessage < AbstractEvent attr_reader :time def initialize(message) super(CGI.unescapeHTML(message)) @time = Time.now end def fields { bod...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/status/abstract_status_event.rb
Ruby
mit
242
master
256
require 'twterm/status' require 'twterm/event/abstract_event' module Twterm module Event module Status class AbstractStatusEvent < AbstractEvent def fields { status: ::Twterm::Status } end end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/notification/retweet.rb
Ruby
mit
242
master
739
require 'twterm/event/notification/abstract_notification' module Twterm module Event module Notification class Retweet < AbstractNotification # @param [Twterm::Status] status # @param [Twterm::User] user def initialize(status, user) @status = status @user = user ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/notification/mention.rb
Ruby
mit
242
master
740
require 'twterm/event/notification/abstract_notification' module Twterm module Event module Notification class Mention < AbstractNotification # @param [Twterm::Status] status # @param [Twterm::User] user def initialize(status, user) @status = status @user = user ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/notification/follow.rb
Ruby
mit
242
master
648
require 'twterm/event/notification/abstract_notification' module Twterm module Event module Notification class Follow < AbstractNotification # @param [Twterm::User] user def initialize(user) @user = user end # @return [String] notification body def body ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/notification/quote.rb
Ruby
mit
242
master
734
require 'twterm/event/notification/abstract_notification' module Twterm module Event module Notification class Quote < AbstractNotification # @param [Twterm::Status] status # @param [Twterm::User] user def initialize(status, user) @status = status @user = user ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/notification/abstract_notification.rb
Ruby
mit
242
master
713
require 'twterm/event/abstract_event' module Twterm module Event module Notification # @abstract class AbstractNotification < AbstractEvent # @abstract # @return [String] notification body def body raise NotImplementedError, '`body` must be implemented' end ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/notification/favorite.rb
Ruby
mit
242
master
732
require 'twterm/event/notification/abstract_notification' module Twterm module Event module Notification class Like < AbstractNotification # @param [Twterm::Status] status # @param [Twterm::User] user def initialize(status, user) @status = status @user = user ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/event/notification/list_member_added.rb
Ruby
mit
242
master
658
require 'twterm/event/notification/abstract_notification' module Twterm module Event module Notification class ListMemberAdded < AbstractNotification # @param [Twterm::List] list def initialize(list) @list = list end # @return [String] notification body de...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/repository/abstract_entity_repository.rb
Ruby
mit
242
master
830
require 'concurrent' require 'twterm/repository/abstract_repository' module Twterm module Repository class AbstractEntityRepository < AbstractRepository def all repository.values end def create(*args) invoke_callbacks(:before_create, *args) existing_instance = find(ex...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/repository/hashtag_repository.rb
Ruby
mit
242
master
620
require 'twterm/hashtag' require 'twterm/repository/abstract_repository' module Twterm module Repository class HashtagRepository < AbstractRepository def initialize @m = Mutex.new super end def all repository.to_a end private def empty_repository ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/repository/status_repository.rb
Ruby
mit
242
master
1,811
require 'twterm/event/status_garbage_collected' require 'twterm/repository/abstract_expirable_entity_repository' require 'twterm/status' module Twterm module Repository class StatusRepository < AbstractExpirableEntityRepository def create(tweet, is_referred_status = false) create(tweet.quoted_statu...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/repository/list_repository.rb
Ruby
mit
242
master
235
require 'twterm/repository/abstract_entity_repository' require 'twterm/list' module Twterm module Repository class ListRepository < AbstractEntityRepository private def type List end end end end
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/repository/abstract_expirable_entity_repository.rb
Ruby
mit
242
master
1,191
require 'concurrent' require 'twterm/publisher' require 'twterm/repository/abstract_entity_repository' module Twterm module Repository class AbstractExpirableEntityRepository < AbstractEntityRepository include Publisher def initialize super @touched_at = Concurrent::Hash.new e...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/repository/abstract_repository.rb
Ruby
mit
242
master
1,416
module Twterm module Repository class AbstractRepository def initialize @repository = empty_repository @callbacks = { after_create: [], before_create: [], } end def after_create(&block) @callbacks[:after_create] << block end def ...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/repository/friendship_repository.rb
Ruby
mit
242
master
2,209
require 'concurrent' require 'twterm/friendship' require 'twterm/repository//abstract_repository' module Twterm module Repository class FriendshipRepository < AbstractRepository private :create def initialize super @user_ids = Set.new @m = Mutex.new end def alr...
github
ryota-ka/twterm
https://github.com/ryota-ka/twterm
lib/twterm/repository/user_repository.rb
Ruby
mit
242
master
487
require 'twterm/event/user_garbage_collected' require 'twterm/repository/abstract_expirable_entity_repository' require 'twterm/user' module Twterm module Repository class UserRepository < AbstractExpirableEntityRepository def ids repository.keys end private def garbage_collectio...