Class: RubyCat::Card
- Inherits:
-
Object
- Object
- RubyCat::Card
- Defined in:
- lib/rubycat/card.rb
Instance Attribute Summary collapse
-
#categories ⇒ Object
readonly
e.g.
-
#gem_url ⇒ Object
readonly
e.g.
-
#github_url ⇒ Object
readonly
e.g.
-
#name ⇒ Object
readonly
e.g.
Instance Method Summary collapse
-
#initialize(card) ⇒ Card
constructor
A new instance of Card.
Constructor Details
#initialize(card) ⇒ Card
Returns a new instance of Card.
14 15 16 17 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 54 55 |
# File 'lib/rubycat/card.rb', line 14 def initialize( card ) @categories = card.categories @name = nil ## todo/fix: lotus/lotusrb - fix: make gem name higher priority ## for now uses github name ## also check/fallback to rubygems name (if no github entry) github_link = card.links.find {|it| it[0].include?( ':octocat:') } if github_link @github_url = github_link[1] ## check if org (shortcut) uri = URI.parse( @github_url ) puts " uri.path: #{uri.path}" ## names = uri.path[1..-1].split('/') ## cut off leading / and split pp names ## if single name (duplicate - downcased! e.g. Ramaze => Ramaze/ramaze) if names.size == 1 @github_url += "/#{names[0].downcase}" @name = names[0].downcase else @name = names[1] end puts "github_url: #{@github_url}" else puts "*** no github_url found" pp card end gem_link = card.links.find {|it| it[0] == ':gem:' } if gem_link @gem_url = gem_link[1] puts "gem_url: #{@gem_url}" else puts "*** no gem_url found" pp card end end |
Instance Attribute Details
#categories ⇒ Object (readonly)
e.g.
11 12 13 |
# File 'lib/rubycat/card.rb', line 11 def categories @categories end |
#gem_url ⇒ Object (readonly)
9 10 11 |
# File 'lib/rubycat/card.rb', line 9 def gem_url @gem_url end |
#github_url ⇒ Object (readonly)
10 11 12 |
# File 'lib/rubycat/card.rb', line 10 def github_url @github_url end |
#name ⇒ Object (readonly)
e.g. sinatra
8 9 10 |
# File 'lib/rubycat/card.rb', line 8 def name @name end |