-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
89 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
class Array | ||
def hrify | ||
self.map(&:chomp).join("\n\n"+_hr+"\n\n").chomp | ||
end | ||
end | ||
|
||
class String | ||
def esc | ||
return "''" if self.empty? | ||
str = self.dup | ||
str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/n, "\\\\\\1") | ||
str.gsub!(/\n/, "'\n'") | ||
str | ||
end | ||
|
||
def cdate | ||
File.ctime(self).strftime('%F') | ||
end | ||
|
||
def achieve_status | ||
if(self.content.split("\n")[0] =~ /ACHIEVE:(.*)/) | ||
$1.chomp.to_sym | ||
else | ||
:regular | ||
end | ||
end | ||
|
||
def achieve_status= what | ||
c = "ACHIEVE:#{what.to_s}\n" + self.content.sub(/ACHIEVE:(.*)\n/, '') | ||
self.content = c; | ||
end | ||
|
||
def basename | ||
File.basename self | ||
end | ||
|
||
def dirname | ||
File.dirname self | ||
end | ||
|
||
def content | ||
r_file self | ||
end | ||
|
||
def content= what | ||
w_file self, what | ||
end | ||
|
||
def strip_home | ||
t = self.dup | ||
t[home_dir() + '/'] = "" | ||
t | ||
end | ||
|
||
def ex | ||
File.expand_path(self) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters