Class: Lolcommits::Loltext
- Defined in:
- lib/lolcommits/plugins/loltext.rb
Instance Attribute Summary
Attributes inherited from Plugin
#default, #name, #options, #runner
Instance Method Summary collapse
-
#initialize(runner) ⇒ Loltext
constructor
A new instance of Loltext.
-
#mm_run ⇒ Object
use minimagick wrapper.
- #run ⇒ Object
Methods inherited from Plugin
#configuration, #execute, #is_enabled?, #plugdebug
Constructor Details
#initialize(runner) ⇒ Loltext
Returns a new instance of Loltext.
4 5 6 7 8 9 10 11 |
# File 'lib/lolcommits/plugins/loltext.rb', line 4 def initialize(runner) super @font_location = runner ? runner.font : nil self.name = 'loltext' self.default = true end |
Instance Method Details
#mm_run ⇒ Object
use minimagick wrapper
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/lolcommits/plugins/loltext.rb', line 18 def mm_run font_location = @font_location || File.join(Configuration::LOLCOMMITS_ROOT, "vendor", "fonts", "Impact.ttf") plugdebug "Annotating image via MiniMagick" image = MiniMagick::Image.open(self.runner.main_image) image. do |c| c.gravity 'SouthWest' c.fill 'white' c.stroke 'black' c.strokewidth '2' c.pointsize '48' c.interline_spacing '-9' c.font font_location c.annotate '0', clean_msg(self.runner.) end image. do |c| c.gravity 'NorthEast' c.fill 'white' c.stroke 'black' c.strokewidth '2' c.pointsize '32' c.font font_location c.annotate '0', self.runner.sha end plugdebug "Writing changed file to #{self.runner.main_image}" image.write self.runner.main_image end |
#run ⇒ Object
13 14 15 |
# File 'lib/lolcommits/plugins/loltext.rb', line 13 def run mm_run end |