Class: Metanorma::Release::Platform::GitHub::ConfigFetcher
- Inherits:
-
Object
- Object
- Metanorma::Release::Platform::GitHub::ConfigFetcher
- Includes:
- ConfigFetcher
- Defined in:
- lib/metanorma/release/platform/github/config_fetcher.rb
Instance Method Summary collapse
- #fetch(source) ⇒ Object
-
#initialize(client:) ⇒ ConfigFetcher
constructor
A new instance of ConfigFetcher.
Constructor Details
#initialize(client:) ⇒ ConfigFetcher
Returns a new instance of ConfigFetcher.
12 13 14 |
# File 'lib/metanorma/release/platform/github/config_fetcher.rb', line 12 def initialize(client:) @client = client end |
Instance Method Details
#fetch(source) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/metanorma/release/platform/github/config_fetcher.rb', line 16 def fetch(source) repo, path = parse_source(source) content = @client.contents(repo, path: path) return nil unless content ChannelConfig.from_yaml(content['content'].unpack1('m0')) rescue StandardError nil end |