Class: Mo2tex::Pic::Writer

Inherits:
Object
  • Object
show all
Includes:
DateTimeHelper
Defined in:
lib/mo2tex/pic.rb

Constant Summary collapse

DAYS_PER_PAGE =
12
DAYS_PER_ROW =
4
LOC_TAGS =

twelve tags in a repeating pattern

[ Location.new('PageFrame', 'nw'), ([[ Location.new('Container', 'ne') ] * 3, Location.new('Container', 'sw') ] * 3).flatten ].flatten

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from DateTimeHelper

#datetime_create

Constructor Details

#initialize(s) ⇒ Writer

Returns a new instance of Writer.



201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/mo2tex/pic.rb', line 201

def initialize(s)
    @total_hours_done = 0
  @school = s
	@header = read_header
	@trailer = read_trailer
	@body = read_body
    @max_daily_hours = calculate_max_daily_hours
    @page_no = @day_no = @event_no = 0
    self.days = []
    generate_days
    self.pages = create_pages
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



198
199
200
# File 'lib/mo2tex/pic.rb', line 198

def body
  @body
end

#day_noObject

Returns the value of attribute day_no.



199
200
201
# File 'lib/mo2tex/pic.rb', line 199

def day_no
  @day_no
end

#daysObject

Returns the value of attribute days.



199
200
201
# File 'lib/mo2tex/pic.rb', line 199

def days
  @days
end

#event_noObject

Returns the value of attribute event_no.



199
200
201
# File 'lib/mo2tex/pic.rb', line 199

def event_no
  @event_no
end

#headerObject (readonly)

Returns the value of attribute header.



198
199
200
# File 'lib/mo2tex/pic.rb', line 198

def header
  @header
end

#max_daily_hoursObject (readonly)

Returns the value of attribute max_daily_hours.



198
199
200
# File 'lib/mo2tex/pic.rb', line 198

def max_daily_hours
  @max_daily_hours
end

#page_noObject

Returns the value of attribute page_no.



199
200
201
# File 'lib/mo2tex/pic.rb', line 199

def page_no
  @page_no
end

#pagesObject

Returns the value of attribute pages.



199
200
201
# File 'lib/mo2tex/pic.rb', line 199

def pages
  @pages
end

#schoolObject (readonly)

Returns the value of attribute school.



198
199
200
# File 'lib/mo2tex/pic.rb', line 198

def school
  @school
end

#total_hours_doneObject (readonly)

Returns the value of attribute total_hours_done.



198
199
200
# File 'lib/mo2tex/pic.rb', line 198

def total_hours_done
  @total_hours_done
end

#trailerObject (readonly)

Returns the value of attribute trailer.



198
199
200
# File 'lib/mo2tex/pic.rb', line 198

def trailer
  @trailer
end

Instance Method Details

#absolute_pic_objects_include_pathObject



225
226
227
# File 'lib/mo2tex/pic.rb', line 225

def absolute_pic_objects_include_path
  return File.expand_path(File.join(['..'] * 3, 'config', 'templates', 'pic', 'objects.pic'), __FILE__)
end

#generateObject



214
215
216
217
218
219
220
221
222
223
# File 'lib/mo2tex/pic.rb', line 214

def generate
    result = ''
    self.pages.each do
      |page|
      result += self.header.result(binding)
	  result += self.body.result(binding)
      result += self.trailer.result(binding)
    end
    return result
end