Class: Jobless::Group
- Inherits:
-
Object
- Object
- Jobless::Group
- Defined in:
- lib/group.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #github_repo(url, &block) ⇒ Object
-
#initialize(name) ⇒ Group
constructor
A new instance of Group.
- #item(&block) ⇒ Object (also: #entry)
Constructor Details
#initialize(name) ⇒ Group
Returns a new instance of Group.
9 10 11 12 13 |
# File 'lib/group.rb', line 9 def initialize(name) @name = name @type = name.parameterize @items = [] end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
7 8 9 |
# File 'lib/group.rb', line 7 def items @items end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/group.rb', line 7 def name @name end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/group.rb', line 7 def type @type end |
Instance Method Details
#github_repo(url, &block) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/group.rb', line 23 def github_repo(url, &block) repo_name = url.match(/([^\/]*)\/([^\/]*)$/).captures.join("/") repo_data = fetch_github_repo_data(repo_name) item = Item.new item.instance_eval do title repo_data['name'] description repo_data['description'] homepage repo_data['html_url'] end item.instance_eval &block if block_given? @items.push item end |