Class: Rocrad::Mixed

Inherits:
Rocrad show all
Defined in:
lib/rocrad/mixed.rb

Instance Attribute Summary collapse

Attributes inherited from Rocrad

#src, #tmp, #txt

Instance Method Summary collapse

Methods inherited from Rocrad

#crop!, #to_s

Constructor Details

#initialize(src = "", options = {}) {|_self| ... } ⇒ Mixed

Returns a new instance of Mixed.

Yields:

  • (_self)

Yield Parameters:

  • _self (Rocrad::Mixed)

    the object that the method was called on



6
7
8
9
10
# File 'lib/rocrad/mixed.rb', line 6

def initialize(src="", options = {})
  super(src)
  @areas = options.delete(:areas) || []
  yield self if block_given?
end

Instance Attribute Details

#areasObject

Returns the value of attribute areas.



4
5
6
# File 'lib/rocrad/mixed.rb', line 4

def areas
  @areas
end

Instance Method Details

#add_area(x, y, w, h) ⇒ Object



12
13
14
15
# File 'lib/rocrad/mixed.rb', line 12

def add_area(x, y, w, h)
  @txt = ""
  @areas << {:x => x, :y => y, :w => w, :h => h}
end