class KielcePlugins::Schedule::Assignment
Constants
- ASSIGNMENT_KEYS
- SHORT_TYPE
Attributes
assigned[RW]
due[RW]
Public Class Methods
new(row)
click to toggle source
# File lib/kielce_plugins/schedule/assignment.rb, line 19 def initialize(row) ASSIGNMENT_KEYS.each { |key| instance_variable_set "@#{key.to_s}".to_sym, row[key] } end
Public Instance Methods
has_type?()
click to toggle source
# File lib/kielce_plugins/schedule/assignment.rb, line 23 def has_type? !@type.nil? end
short_type()
click to toggle source
# File lib/kielce_plugins/schedule/assignment.rb, line 31 def short_type return '' unless has_type? key = @type.downcase.to_sym $stderr.puts "Unknown type #{@type}" unless SHORT_TYPE.has_key?(key) SHORT_TYPE[key] end
title(style = :original, linked=false)
click to toggle source
# File lib/kielce_plugins/schedule/assignment.rb, line 38 def title(style = :original, linked=false) case style when :original text = @title when :short_type type_num = has_type? ? "#{short_type}#{@number}: " : '' text = "#{type_num}#{@title}" when :full type_string = has_type? ? "#{@type} #{@number}: " : '' text = "#{type_string}#{@title}" else $stderr.puts "Unknown style #{sytle}" text = nil end # build a link, if a link provided (linked && !@link.nil?) ? "<a href='#{@link}'>#{text}</a>" : text end
type()
click to toggle source
# File lib/kielce_plugins/schedule/assignment.rb, line 27 def type @type.to_s end