Class: Curldown::GitHub
Constant Summary collapse
- CORE_URL =
"https://raw.githubusercontent.com"
Instance Attribute Summary collapse
-
#readme_md ⇒ Object
Returns the value of attribute readme_md.
-
#repo_name ⇒ Object
Returns the value of attribute repo_name.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #get_readme ⇒ Object
-
#initialize(u, r) ⇒ GitHub
constructor
A new instance of GitHub.
- #perform ⇒ Object
Methods included from Curldown
Constructor Details
#initialize(u, r) ⇒ GitHub
Returns a new instance of GitHub.
76 77 78 79 |
# File 'lib/curldown.rb', line 76 def initialize(u, r) @user= u @repo_name= r end |
Instance Attribute Details
#readme_md ⇒ Object
Returns the value of attribute readme_md.
75 76 77 |
# File 'lib/curldown.rb', line 75 def readme_md @readme_md end |
#repo_name ⇒ Object
Returns the value of attribute repo_name.
75 76 77 |
# File 'lib/curldown.rb', line 75 def repo_name @repo_name end |
#user ⇒ Object
Returns the value of attribute user.
75 76 77 |
# File 'lib/curldown.rb', line 75 def user @user end |
Instance Method Details
#get_readme ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/curldown.rb', line 83 def get_readme ["readme.md", "README.md", "README.MD", "Readme.md"].each{|file| begin @readme_md= get("#{CORE_URL}/#{@user}/#{@repo_name}/master/#{file}", json: false) rescue false end } if !@readme_md raise StandardError.new("No readme file found.") else @readme_md end end |
#perform ⇒ Object
80 81 82 |
# File 'lib/curldown.rb', line 80 def perform get_readme end |