Class: Memerize
- Inherits:
-
Object
- Object
- Memerize
- Defined in:
- lib/memerize.rb
Instance Attribute Summary collapse
-
#meme_name ⇒ Object
Returns the value of attribute meme_name.
-
#memes ⇒ Object
Returns the value of attribute memes.
-
#text_footer ⇒ Object
Returns the value of attribute text_footer.
-
#text_top ⇒ Object
Returns the value of attribute text_top.
Instance Method Summary collapse
- #create_meme ⇒ Object
-
#initialize ⇒ Memerize
constructor
A new instance of Memerize.
Constructor Details
#initialize ⇒ Memerize
Returns a new instance of Memerize.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/memerize.rb', line 8 def initialize self.memes = { :cao => "/cao_base.jpg", :fry => "/fry_base.jpg", :yuno => "/yuno_base.jpg", :falone => "/falone_base.jpg", :successkid => "/successkid_base.jpg", :facebookgirl => "/facebookgirl_base.jpg" } self.meme_name = ARGV[0] self.text_top = ARGV[1] self. = ARGV[2] create_meme() end |
Instance Attribute Details
#meme_name ⇒ Object
Returns the value of attribute meme_name.
6 7 8 |
# File 'lib/memerize.rb', line 6 def meme_name @meme_name end |
#memes ⇒ Object
Returns the value of attribute memes.
6 7 8 |
# File 'lib/memerize.rb', line 6 def memes @memes end |
#text_footer ⇒ Object
Returns the value of attribute text_footer.
6 7 8 |
# File 'lib/memerize.rb', line 6 def @text_footer end |
#text_top ⇒ Object
Returns the value of attribute text_top.
6 7 8 |
# File 'lib/memerize.rb', line 6 def text_top @text_top end |
Instance Method Details
#create_meme ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/memerize.rb', line 23 def create_meme() dir_images = File.(File.dirname(__FILE__) + '/../lib/images') image = ImageList.new(dir_images + @memes[@meme_name.to_sym]) text = Draw.new text.pointsize = 46 text.stroke = "black" text.stroke_width = 2 text.fill = "white" text.font_family = "Impact-Normal" text.font_weight = BoldWeight text.annotate(image, 0, 0, 0, 9, self.text_top) { self.gravity = NorthGravity } text.annotate(image, 0, 0, 0, 9, self.) { self.gravity = SouthGravity } image.write("#{self.meme_name}.jpg") end |