Module: ReadmeScore

Defined in:
lib/readme-score.rb,
lib/readme-score/util.rb,
lib/readme-score/version.rb,
lib/readme-score/document.rb,
lib/readme-score/document/score.rb,
lib/readme-score/document/filter.rb,
lib/readme-score/document/loader.rb,
lib/readme-score/document/parser.rb,
lib/readme-score/document/metrics.rb,
lib/readme-score/document/loader/github_readme_finder.rb

Defined Under Namespace

Modules: Util Classes: Document

Constant Summary collapse

ROOT =
File.expand_path(File.join(File.dirname(__FILE__), ".."))
VERSION =
"0.0.2"

Class Method Summary collapse

Class Method Details

.document(url_or_html) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/readme-score.rb', line 20

def document(url_or_html)
  document = nil
  if Document::Loader.is_url?(url_or_html)
    document = Document.load(url_or_html)
  elsif Document::Loader.is_github_repo_slug?(url_or_html)
    document = Document.load("http://github.com/#{url_or_html}")
  else
    document = Document.new(url_or_html)
  end
  document
end

.for(url_or_html) ⇒ Object



16
17
18
# File 'lib/readme-score.rb', line 16

def for(url_or_html)
  document(url_or_html).score
end

.github_api_tokenObject



44
45
46
# File 'lib/readme-score.rb', line 44

def github_api_token
  @github_api_token || ENV['READMESCORE_GITHUB_TOKEN']
end

.github_api_token=(github_api_token) ⇒ Object



40
41
42
# File 'lib/readme-score.rb', line 40

def github_api_token=(github_api_token)
  @github_api_token = github_api_token
end

.use_github_api=(use_github_api) ⇒ Object



36
37
38
# File 'lib/readme-score.rb', line 36

def use_github_api=(use_github_api)
  @reject_github_api = !use_github_api
end

.use_github_api?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/readme-score.rb', line 32

def use_github_api?
  !@reject_github_api
end