Class: Toto::Repo

Inherits:
Hash show all
Includes:
Template
Defined in:
lib/toto.rb

Constant Summary collapse

README =
"http://github.com/%s/%s/raw/master/README.%s"

Instance Method Summary collapse

Methods included from Template

included, #markdown, #method_missing, #to_html

Constructor Details

#initialize(name, config) ⇒ Repo

Returns a new instance of Repo.



199
200
201
# File 'lib/toto.rb', line 199

def initialize name, config
  self[:name], @config = name, config
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Toto::Template

Instance Method Details

#readmeObject Also known as: content



203
204
205
206
207
208
# File 'lib/toto.rb', line 203

def readme
  markdown open(README %
    [@config[:github][:user], self[:name], @config[:github][:ext]]).read
rescue Timeout::Error, OpenURI::HTTPError => e
  "This page isn't available."
end