Class: Verso::Task

Inherits:
Base
  • Object
show all
Includes:
HTTPGettable
Defined in:
lib/verso/task.rb

Overview

Task resource

A Course task/competency contained by a DutyArea or a CorrelationList.

Note:

Any attributes may be set upon instantiation, using Options Hash. The following are required:

Options Hash (attrs):

  • :code (String)

    Course code Required

  • :edition (String)

    Edition year Required

  • :id (String)

    Task ID Required

Instance Attribute Summary collapse

Attributes inherited from Base

#attrs

Instance Method Summary collapse

Methods inherited from Base

attr_reader, #initialize

Constructor Details

This class inherits a constructor from Verso::Base

Instance Attribute Details

#codeString (readonly)

Returns Course code.

Returns:

  • (String)

    Course code



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
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#definitionString (readonly)

Returns HTML-formatted Task definition.

Returns:

  • (String)

    HTML-formatted Task definition



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
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#editionString (readonly)

Returns Course edition year.

Returns:

  • (String)

    Course edition year



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
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#idString (readonly)

Returns Task ID.

Returns:

  • (String)

    Task ID



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
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#questionsString (readonly)

Returns HTML-formatted process/skill questions.

Returns:

  • (String)

    HTML-formatted process/skill questions



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
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#sensitiveBoolean (readonly) Also known as: sensitive?

Returns Is this task sensitive?.

Returns:

  • (Boolean)

    Is this task sensitive?



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
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

#statementString (readonly)

Returns Task/competency statement.

Returns:

  • (String)

    Task/competency statement



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
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/verso/task.rb', line 28

class Task < Verso::Base
  include HTTPGettable
  attr_reader :code, :definition, :edition, :id, :sensitive, :statement,
    :questions
  alias sensitive? sensitive

  # @return [Boolean] Does this task have only a statement?
  def bare?
    definition.empty? && standards.sols.empty?
  end

  # @return [Boolean] Is this task considered essential?
  def essential
    sensitive ? true : get_attr(:essential)
  end
  alias essential? essential

  # @return [Verso::StandardsList] Standards related to this task
  def standards
    # Yuck. Inject goals if we already have them, i.e. a correlation list.
    # Otherwise, children will fetch resources and we get *all* the
    # standards in the correlation lists.
    raw_goals =  get_attr(:goals).collect do |k,v|
                   v.merge(:name => k, :code => code, :edition => edition)
                 end
    @standards ||= StandardsList.new(
      :code => code, :edition => edition, :standards => raw_goals
    )
  end
  alias goals standards

private

  def path
    "/courses/#{code},#{edition}/tasks/#{id}"
  end
end

Instance Method Details

#bare?Boolean

Returns Does this task have only a statement?.

Returns:

  • (Boolean)

    Does this task have only a statement?



35
36
37
# File 'lib/verso/task.rb', line 35

def bare?
  definition.empty? && standards.sols.empty?
end

#essentialBoolean Also known as: essential?

Returns Is this task considered essential?.

Returns:

  • (Boolean)

    Is this task considered essential?



40
41
42
# File 'lib/verso/task.rb', line 40

def essential
  sensitive ? true : get_attr(:essential)
end

#standardsVerso::StandardsList Also known as: goals

Returns Standards related to this task.

Returns:



46
47
48
49
50
51
52
53
54
55
56
# File 'lib/verso/task.rb', line 46

def standards
  # Yuck. Inject goals if we already have them, i.e. a correlation list.
  # Otherwise, children will fetch resources and we get *all* the
  # standards in the correlation lists.
  raw_goals =  get_attr(:goals).collect do |k,v|
                 v.merge(:name => k, :code => code, :edition => edition)
               end
  @standards ||= StandardsList.new(
    :code => code, :edition => edition, :standards => raw_goals
  )
end