Class: Verso::Cluster
- Includes:
- HTTPGettable, Sluggable
- 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.
-
#title ⇒ String
Cluster title.
Methods included from Sluggable
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 |
# File 'lib/verso/cluster.rb', line 20 class Cluster < Verso::Base include HTTPGettable include Sluggable 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] 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 |
# File 'lib/verso/cluster.rb', line 20 class Cluster < Verso::Base include HTTPGettable include Sluggable 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] 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 |
# File 'lib/verso/cluster.rb', line 20 class Cluster < Verso::Base include HTTPGettable include Sluggable 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] 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 |
# File 'lib/verso/cluster.rb', line 20 class Cluster < Verso::Base include HTTPGettable include Sluggable 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] 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.
29 30 31 |
# File 'lib/verso/cluster.rb', line 29 def contact @contact ||= OpenStruct.new(get_attr(:contact)) end |
#courses ⇒ Verso::CourseList
Courses related to the Cluster
36 37 38 39 40 |
# File 'lib/verso/cluster.rb', line 36 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
48 49 50 51 |
# File 'lib/verso/cluster.rb', line 48 def pathways @pathways ||= get_attr(:pathways). collect { |p| Pathway.new(p) } end |
#title ⇒ String
Returns Cluster title.
54 55 56 |
# File 'lib/verso/cluster.rb', line 54 def title @title ||= attrs[:title] || attrs[:cluster][:title] end |