twat 0.4.5 → 0.4.6

Sign up to get free protection for your applications and to get access to all the features.
data/lib/twat.rb CHANGED
@@ -45,7 +45,7 @@ end
45
45
  module Twat
46
46
  VERSION_MAJOR = 0
47
47
  VERSION_MINOR = 4
48
- VERSION_PATCH = 5
48
+ VERSION_PATCH = 6
49
49
 
50
50
  VERSION = "#{VERSION_MAJOR}.#{VERSION_MINOR}.#{VERSION_PATCH}"
51
51
  class Twat
data/lib/twat/actions.rb CHANGED
@@ -130,19 +130,27 @@ module Twat
130
130
 
131
131
  # Format a tweet all pretty like
132
132
  def format(twt)
133
+ text = deentitize(twt.text)
133
134
  if config.colors?
134
135
  if twt.user.screen_name == account_name.to_s
135
- puts "#{twt.user.screen_name.bold.blue}: #{twt.text}"
136
- elsif twt.text.mentions?(account_name)
137
- puts "#{twt.user.screen_name.bold.red}: #{twt.text}"
136
+ puts "#{twt.user.screen_name.bold.blue}: #{text}"
137
+ elsif text.mentions?(account_name)
138
+ puts "#{twt.user.screen_name.bold.red}: #{text}"
138
139
  else
139
- puts "#{twt.user.screen_name.bold.cyan}: #{twt.text}"
140
+ puts "#{twt.user.screen_name.bold.cyan}: #{text}"
140
141
  end
141
142
  else
142
- puts "#{twt.user.screen_name}: #{twt.text}"
143
+ puts "#{twt.user.screen_name}: #{text}"
143
144
  end
144
145
  end
145
146
 
147
+ def deentitize(text)
148
+ {"&lt;" => "<", "&gt;" => ">" }.each do |k,v|
149
+ text.gsub!(k, v)
150
+ end
151
+ text
152
+ end
153
+
146
154
  def twitter_auth
147
155
  Twitter.configure do |twit|
148
156
  account.each do |key, value|
data/lib/twat/options.rb CHANGED
@@ -3,6 +3,10 @@ module Twat
3
3
  BOOL_TRUE=["yes", "true", "1", "on"]
4
4
  BOOL_FALSE=["no", "false", "0", "off"]
5
5
  BOOL_VALS = BOOL_TRUE + BOOL_FALSE
6
+
7
+ # TODO - Some meta programming to just define boolean values ala
8
+ # attr_accessor
9
+
6
10
  def self.bool_true?(val)
7
11
  BOOL_TRUE.include?(val.to_s.downcase)
8
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.5
4
+ version: 0.4.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-10-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: twitter
16
- requirement: &15590620 !ruby/object:Gem::Requirement
16
+ requirement: &17152980 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15590620
24
+ version_requirements: *17152980
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: oauth
27
- requirement: &15590160 !ruby/object:Gem::Requirement
27
+ requirement: &17152440 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *15590160
35
+ version_requirements: *17152440
36
36
  description: Command line tool for tweeting and whatnot
37
37
  email:
38
38
  - richo@psych0tik.net