Class: Verso::TaskList
Overview
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
Course code.
-
#edition ⇒ String
readonly
Course edition.
Attributes inherited from Base
Instance Method Summary collapse
-
#has_optional_task? ⇒ Boolean
Contains non-essential tasks?.
-
#has_sensitive_task? ⇒ Boolean
Contains sensitive tasks?.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Verso::Base
Instance Attribute Details
#code ⇒ String (readonly)
Returns Course code.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/verso/task_list.rb', line 18 class TaskList < Verso::Base include Enumerable include HTTPGettable extend Forwardable def_delegators :duty_areas, :[], :each, :empty?, :last, :length attr_reader :code, :edition # @return [Boolean] Contains non-essential tasks? def has_optional_task? any? { |da| da.tasks.any? { |t| !t.essential } } end # @return [Boolean] Contains sensitive tasks? def has_sensitive_task? any? { |da| da.tasks.any? { |t| t.sensitive } } end private def duty_areas @duty_areas ||= begin get_attr(:duty_areas). collect do |da| DutyArea.new( da.merge!(:code => code, :edition => edition) ) end rescue NameError, Verso::ResourceNotFoundError [] end end def path "/courses/#{code},#{edition}/tasks/" end end |
#edition ⇒ String (readonly)
Returns Course edition.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/verso/task_list.rb', line 18 class TaskList < Verso::Base include Enumerable include HTTPGettable extend Forwardable def_delegators :duty_areas, :[], :each, :empty?, :last, :length attr_reader :code, :edition # @return [Boolean] Contains non-essential tasks? def has_optional_task? any? { |da| da.tasks.any? { |t| !t.essential } } end # @return [Boolean] Contains sensitive tasks? def has_sensitive_task? any? { |da| da.tasks.any? { |t| t.sensitive } } end private def duty_areas @duty_areas ||= begin get_attr(:duty_areas). collect do |da| DutyArea.new( da.merge!(:code => code, :edition => edition) ) end rescue NameError, Verso::ResourceNotFoundError [] end end def path "/courses/#{code},#{edition}/tasks/" end end |
Instance Method Details
#has_optional_task? ⇒ Boolean
Returns Contains non-essential tasks?.
26 27 28 |
# File 'lib/verso/task_list.rb', line 26 def has_optional_task? any? { |da| da.tasks.any? { |t| !t.essential } } end |
#has_sensitive_task? ⇒ Boolean
Returns Contains sensitive tasks?.
31 32 33 |
# File 'lib/verso/task_list.rb', line 31 def has_sensitive_task? any? { |da| da.tasks.any? { |t| t.sensitive } } end |