Class: PandocBinary::Release
- Inherits:
-
Struct
- Object
- Struct
- PandocBinary::Release
- Extended by:
- RawDataParsable, TimeAttributeParsable
- Defined in:
- lib/pandoc_binary.rb
Defined Under Namespace
Classes: Asset
Constant Summary collapse
- URI_BASE =
"https://api.github.com/repos/jgm/pandoc/releases/tags/%{version}"
Instance Attribute Summary collapse
-
#assets ⇒ Object
Returns the value of attribute assets.
-
#published_at ⇒ Object
Returns the value of attribute published_at.
-
#tag_name ⇒ Object
Returns the value of attribute tag_name.
Class Method Summary collapse
Instance Method Summary collapse
Methods included from RawDataParsable
Methods included from TimeAttributeParsable
Instance Attribute Details
#assets ⇒ Object
Returns the value of attribute assets
69 70 71 |
# File 'lib/pandoc_binary.rb', line 69 def assets @assets end |
#published_at ⇒ Object
Returns the value of attribute published_at
69 70 71 |
# File 'lib/pandoc_binary.rb', line 69 def published_at @published_at end |
#tag_name ⇒ Object
Returns the value of attribute tag_name
69 70 71 |
# File 'lib/pandoc_binary.rb', line 69 def tag_name @tag_name end |
Class Method Details
.fetch_by_version(version) ⇒ Object
87 88 89 90 91 92 |
# File 'lib/pandoc_binary.rb', line 87 def fetch_by_version(version) uri = URI(URI_BASE % {version: version}) json = Net::HTTP.get(uri) raw_release = JSON.parse(json, symbolize_names: true) return from_raw_data(raw_release) end |
.from_raw_data(raw_data) ⇒ Object
79 80 81 82 83 84 85 |
# File 'lib/pandoc_binary.rb', line 79 def from_raw_data(raw_data) result = super result.assets = raw_data[:assets].map { |raw_asset| Asset.from_raw_data(raw_asset) } return result end |
Instance Method Details
#asset_by_architecture(architecture) ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/pandoc_binary.rb', line 102 def asset_by_architecture(architecture) architecture.asset_name_patterns.each do |pattern| assets.each do |asset| return asset if asset.name.end_with?(architecture.archive_suffix) && asset.name.include?(pattern) end end return nil end |