mirror of https://github.com/Calamitous/iris.git
Minor dead code removal and tidying
This commit is contained in:
parent
e9164717fd
commit
1c124349eb
25
iris.rb
25
iris.rb
|
@ -32,10 +32,6 @@ class Config
|
||||||
"#{messagefile_filename}.read"
|
"#{messagefile_filename}.read"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.historyfile_filename
|
|
||||||
"#{messagefile_filename}.history"
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.enable_debug_mode
|
def self.enable_debug_mode
|
||||||
@@debug_mode = true
|
@@debug_mode = true
|
||||||
end
|
end
|
||||||
|
@ -331,8 +327,6 @@ class IrisFile
|
||||||
end
|
end
|
||||||
|
|
||||||
class Message
|
class Message
|
||||||
FILE_FORMAT = 'v2'
|
|
||||||
|
|
||||||
attr_reader :timestamp, :edit_hash, :author, :parent, :message, :errors, :is_deleted
|
attr_reader :timestamp, :edit_hash, :author, :parent, :message, :errors, :is_deleted
|
||||||
|
|
||||||
def initialize(message, parent = nil, author = Config::AUTHOR, edit_hash = nil, timestamp = Time.now.utc.iso8601, is_deleted = nil)
|
def initialize(message, parent = nil, author = Config::AUTHOR, edit_hash = nil, timestamp = Time.now.utc.iso8601, is_deleted = nil)
|
||||||
|
@ -399,10 +393,6 @@ class Message
|
||||||
@errors.empty?
|
@errors.empty?
|
||||||
end
|
end
|
||||||
|
|
||||||
def topic?
|
|
||||||
parent.nil?
|
|
||||||
end
|
|
||||||
|
|
||||||
def replace!
|
def replace!
|
||||||
new_corpus = Corpus.mine.reject { |message| message.hash == self.hash } << self
|
new_corpus = Corpus.mine.reject { |message| message.hash == self.hash } << self
|
||||||
IrisFile.write_corpus(JSON.pretty_generate(new_corpus))
|
IrisFile.write_corpus(JSON.pretty_generate(new_corpus))
|
||||||
|
@ -497,6 +487,7 @@ class Message
|
||||||
[to_display] + replies.map(&:to_display)
|
[to_display] + replies.map(&:to_display)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# TODO: Is this only used for hashing? Maybe rename.
|
||||||
def to_json(*args)
|
def to_json(*args)
|
||||||
{
|
{
|
||||||
hash: hash,
|
hash: hash,
|
||||||
|
@ -536,15 +527,15 @@ class Message
|
||||||
end
|
end
|
||||||
|
|
||||||
def leader_text
|
def leader_text
|
||||||
topic? ? "{g ***} [#{topic_id}] #{status_flag}" : ["{g ===}", "[#{id}]", status_flag].compact.join(' ')
|
is_topic? ? "{g ***} [#{topic_id}] #{status_flag}" : ["{g ===}", "[#{id}]", status_flag].compact.join(' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
def verb_text
|
def verb_text
|
||||||
topic? ? 'posted' : 'replied'
|
is_topic? ? 'posted' : 'replied'
|
||||||
end
|
end
|
||||||
|
|
||||||
def indent_text
|
def indent_text
|
||||||
topic? ? '' : ' | '
|
is_topic? ? '' : ' | '
|
||||||
end
|
end
|
||||||
|
|
||||||
def unconfirmed_payload
|
def unconfirmed_payload
|
||||||
|
@ -564,8 +555,6 @@ class Display
|
||||||
WIDTH = [ENV['COLUMNS'].to_i, `tput cols`.chomp.to_i, MIN_WIDTH].compact.max
|
WIDTH = [ENV['COLUMNS'].to_i, `tput cols`.chomp.to_i, MIN_WIDTH].compact.max
|
||||||
HEIGHT = [ENV['ROWS'].to_i, `tput lines`.chomp.to_i, MIN_HEIGHT].compact.max
|
HEIGHT = [ENV['ROWS'].to_i, `tput lines`.chomp.to_i, MIN_HEIGHT].compact.max
|
||||||
|
|
||||||
# p Readline.get_screen_size
|
|
||||||
# WIDTH = Readline.get_screen_size[1]
|
|
||||||
TITLE_WIDTH = WIDTH - 26
|
TITLE_WIDTH = WIDTH - 26
|
||||||
|
|
||||||
def self.permissions_error(filename, file_description, permission_string, mode_string, consequence = nil)
|
def self.permissions_error(filename, file_description, permission_string, mode_string, consequence = nil)
|
||||||
|
@ -856,9 +845,9 @@ class Interface
|
||||||
return show_topic(cmd) if cmd =~ /^\d+$/
|
return show_topic(cmd) if cmd =~ /^\d+$/
|
||||||
# If we've gotten this far, we must have args. Let's handle 'em.
|
# If we've gotten this far, we must have args. Let's handle 'em.
|
||||||
arg = tokens.last
|
arg = tokens.last
|
||||||
return reply(arg) if cmd == 'reply'
|
return reply(arg) if cmd == 'reply'
|
||||||
return edit(arg) if cmd == 'edit'
|
return edit(arg) if cmd == 'edit'
|
||||||
return delete(arg) if cmd == 'delete'
|
return delete(arg) if cmd == 'delete'
|
||||||
return mark_read(arg) if cmd == 'mark_read'
|
return mark_read(arg) if cmd == 'mark_read'
|
||||||
Display.say 'Unrecognized command. Type "help" for a list of available commands.'
|
Display.say 'Unrecognized command. Type "help" for a list of available commands.'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue