Class: Verso::Cluster
- Includes:
- HTTPGettable
- Defined in:
- lib/verso/cluster.rb
Overview
Career Cluster Resource
Instance Attribute Summary collapse
-
#code ⇒ String
readonly
Cluster code.
-
#description ⇒ String
readonly
HTML-formatted Cluster description.
-
#id ⇒ Fixnum
readonly
Cluster id.
-
#postsecondary_info ⇒ String
readonly
HTML-formatted postsecondary preparation info.
Attributes inherited from Base
Instance Method Summary collapse
-
#contact ⇒ OpenStruct
Return VDOE Cluster contact.
-
#courses ⇒ Verso::CourseList
Courses related to the Cluster.
-
#pathways ⇒ Array
The Cluster’s Pathways.
-
#slug ⇒ String
Parameterized title.
-
#title ⇒ String
Cluster title.
Methods inherited from Base
Constructor Details
This class inherits a constructor from Verso::Base
Instance Attribute Details
#code ⇒ String (readonly)
Returns Cluster code.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/verso/cluster.rb', line 20 class Cluster < Verso::Base include HTTPGettable attr_reader :code, :description, :id, :postsecondary_info # Return VDOE Cluster contact. The contact will respond to #name, #email, # and #phone, returning Strings. # # @return [OpenStruct] def contact @contact ||= OpenStruct.new(get_attr(:contact)) end # Courses related to the Cluster # # @return [Verso::CourseList] def courses @courses ||= CourseList.new(:cluster => slug.gsub('-', ' ')). sort_by { |c| c.title + c.edition }. uniq { |c| c.code + c.edition } end # The Cluster's Pathways # # @see http://www.careertech.org/career-clusters/clusters-occupations.html # @see Verso::Pathway # # @return [Array] def pathways @pathways ||= get_attr(:pathways). collect { |p| Pathway.new(p) } end # @return [String] parameterized title def slug title.parameterize end # @return [String] Cluster title def title @title ||= attrs[:title] || attrs[:cluster][:title] end private def fetch super[:cluster] end # @return [String] URI for Cluster resource def path "/clusters/#{id}" end end |
#description ⇒ String (readonly)
Returns HTML-formatted Cluster description.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/verso/cluster.rb', line 20 class Cluster < Verso::Base include HTTPGettable attr_reader :code, :description, :id, :postsecondary_info # Return VDOE Cluster contact. The contact will respond to #name, #email, # and #phone, returning Strings. # # @return [OpenStruct] def contact @contact ||= OpenStruct.new(get_attr(:contact)) end # Courses related to the Cluster # # @return [Verso::CourseList] def courses @courses ||= CourseList.new(:cluster => slug.gsub('-', ' ')). sort_by { |c| c.title + c.edition }. uniq { |c| c.code + c.edition } end # The Cluster's Pathways # # @see http://www.careertech.org/career-clusters/clusters-occupations.html # @see Verso::Pathway # # @return [Array] def pathways @pathways ||= get_attr(:pathways). collect { |p| Pathway.new(p) } end # @return [String] parameterized title def slug title.parameterize end # @return [String] Cluster title def title @title ||= attrs[:title] || attrs[:cluster][:title] end private def fetch super[:cluster] end # @return [String] URI for Cluster resource def path "/clusters/#{id}" end end |
#id ⇒ Fixnum (readonly)
Returns Cluster id.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/verso/cluster.rb', line 20 class Cluster < Verso::Base include HTTPGettable attr_reader :code, :description, :id, :postsecondary_info # Return VDOE Cluster contact. The contact will respond to #name, #email, # and #phone, returning Strings. # # @return [OpenStruct] def contact @contact ||= OpenStruct.new(get_attr(:contact)) end # Courses related to the Cluster # # @return [Verso::CourseList] def courses @courses ||= CourseList.new(:cluster => slug.gsub('-', ' ')). sort_by { |c| c.title + c.edition }. uniq { |c| c.code + c.edition } end # The Cluster's Pathways # # @see http://www.careertech.org/career-clusters/clusters-occupations.html # @see Verso::Pathway # # @return [Array] def pathways @pathways ||= get_attr(:pathways). collect { |p| Pathway.new(p) } end # @return [String] parameterized title def slug title.parameterize end # @return [String] Cluster title def title @title ||= attrs[:title] || attrs[:cluster][:title] end private def fetch super[:cluster] end # @return [String] URI for Cluster resource def path "/clusters/#{id}" end end |
#postsecondary_info ⇒ String (readonly)
Returns HTML-formatted postsecondary preparation info.
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/verso/cluster.rb', line 20 class Cluster < Verso::Base include HTTPGettable attr_reader :code, :description, :id, :postsecondary_info # Return VDOE Cluster contact. The contact will respond to #name, #email, # and #phone, returning Strings. # # @return [OpenStruct] def contact @contact ||= OpenStruct.new(get_attr(:contact)) end # Courses related to the Cluster # # @return [Verso::CourseList] def courses @courses ||= CourseList.new(:cluster => slug.gsub('-', ' ')). sort_by { |c| c.title + c.edition }. uniq { |c| c.code + c.edition } end # The Cluster's Pathways # # @see http://www.careertech.org/career-clusters/clusters-occupations.html # @see Verso::Pathway # # @return [Array] def pathways @pathways ||= get_attr(:pathways). collect { |p| Pathway.new(p) } end # @return [String] parameterized title def slug title.parameterize end # @return [String] Cluster title def title @title ||= attrs[:title] || attrs[:cluster][:title] end private def fetch super[:cluster] end # @return [String] URI for Cluster resource def path "/clusters/#{id}" end end |
Instance Method Details
#contact ⇒ OpenStruct
Return VDOE Cluster contact. The contact will respond to #name, #email, and #phone, returning Strings.
28 29 30 |
# File 'lib/verso/cluster.rb', line 28 def contact @contact ||= OpenStruct.new(get_attr(:contact)) end |
#courses ⇒ Verso::CourseList
Courses related to the Cluster
35 36 37 38 39 |
# File 'lib/verso/cluster.rb', line 35 def courses @courses ||= CourseList.new(:cluster => slug.gsub('-', ' ')). sort_by { |c| c.title + c.edition }. uniq { |c| c.code + c.edition } end |
#pathways ⇒ Array
The Cluster’s Pathways
47 48 49 50 |
# File 'lib/verso/cluster.rb', line 47 def pathways @pathways ||= get_attr(:pathways). collect { |p| Pathway.new(p) } end |
#slug ⇒ String
Returns parameterized title.
53 54 55 |
# File 'lib/verso/cluster.rb', line 53 def slug title.parameterize end |
#title ⇒ String
Returns Cluster title.
58 59 60 |
# File 'lib/verso/cluster.rb', line 58 def title @title ||= attrs[:title] || attrs[:cluster][:title] end |