Class: M2A::Renderer

Inherits:
Object
  • Object
show all
Defined in:
lib/m2a/core/m2a.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#heightObject

Returns the value of attribute height.



3
4
5
# File 'lib/m2a/core/m2a.rb', line 3

def height
  @height
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'lib/m2a/core/m2a.rb', line 3

def width
  @width
end

Instance Method Details

#configure(&block) ⇒ Object



5
6
7
8
9
# File 'lib/m2a/core/m2a.rb', line 5

def configure(&block)
  if block_given?
    yield self
  end
end

#render(meme) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/m2a/core/m2a.rb', line 11

def render(meme)
  validate_args!

  if height && width
    size = "--size=#{width}x#{height}"
  elsif height
    size = "--height=#{height}"
  elsif width
    size = "--width=#{width}"
  end

  # XXX Bail is size is unset?

  puts "jp2a #{size} #{meme.path}"

  return `jp2a #{size} #{meme.path}`
end