Class: Lgtmit::Compositer
- Inherits:
-
Object
- Object
- Lgtmit::Compositer
- Defined in:
- lib/lgtmit/compositer.rb
Constant Summary collapse
- POS =
"0, 0"
- TEXT =
"LGTM"
- COLOR =
"#ffffff"
- GRAV =
"center"
- FMT =
"png"
- P_SCALE =
3
Instance Attribute Summary collapse
-
#file_name ⇒ Object
Returns the value of attribute file_name.
-
#image ⇒ Object
Returns the value of attribute image.
Instance Method Summary collapse
- #configure_image! ⇒ Object
-
#initialize(file_name) ⇒ Compositer
constructor
A new instance of Compositer.
- #run ⇒ Object
- #write_image! ⇒ Object
Constructor Details
#initialize(file_name) ⇒ Compositer
Returns a new instance of Compositer.
14 15 16 17 |
# File 'lib/lgtmit/compositer.rb', line 14 def initialize(file_name) @file_name = file_name @image = MiniMagick::Image.open(@file_name) end |
Instance Attribute Details
#file_name ⇒ Object
Returns the value of attribute file_name.
5 6 7 |
# File 'lib/lgtmit/compositer.rb', line 5 def file_name @file_name end |
#image ⇒ Object
Returns the value of attribute image.
5 6 7 |
# File 'lib/lgtmit/compositer.rb', line 5 def image @image end |
Instance Method Details
#configure_image! ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/lgtmit/compositer.rb', line 24 def configure_image! @image. do |config| config.fill COLOR config.gravity GRAV config.pointsize p_size_calc config.draw "text #{POS} '#{TEXT}'" end @image.format FMT @image end |
#run ⇒ Object
19 20 21 22 |
# File 'lib/lgtmit/compositer.rb', line 19 def run configure_image! write_image! end |
#write_image! ⇒ Object
35 36 37 |
# File 'lib/lgtmit/compositer.rb', line 35 def write_image! @image.write "#{TEXT}_#{Pathname.new(file_name).basename.to_s}" end |