class Bluebird::Strategies::Strip::Strategy
Public Class Methods
run(tweet, config)
click to toggle source
# File lib/bluebird/strategies/strip/strategy.rb, line 7 def run(tweet, config) if run?(tweet, config.max_length) strip(tweet) end end
Private Class Methods
run?(tweet, max)
click to toggle source
# File lib/bluebird/strategies/strip/strategy.rb, line 15 def run?(tweet, max) tweet.length > max end
strip(tweet)
click to toggle source
# File lib/bluebird/strategies/strip/strategy.rb, line 19 def strip(tweet) first = tweet.partials.first last = tweet.partials.last first.content.lstrip! if first.text? last.content.rstrip! if last.text? end