Class: Generator::Entrypoint
- Inherits:
-
Object
- Object
- Generator::Entrypoint
- Defined in:
- lib/generator/entrypoint.rb
Instance Attribute Summary collapse
-
#apis ⇒ Object
readonly
Returns the value of attribute apis.
Instance Method Summary collapse
- #apis_with_latest_version ⇒ Object
- #generate ⇒ Object
-
#initialize(apis) ⇒ Entrypoint
constructor
A new instance of Entrypoint.
- #required_libraries ⇒ Object
Constructor Details
#initialize(apis) ⇒ Entrypoint
Returns a new instance of Entrypoint.
11 12 13 |
# File 'lib/generator/entrypoint.rb', line 11 def initialize(apis) @apis = apis end |
Instance Attribute Details
#apis ⇒ Object (readonly)
Returns the value of attribute apis.
9 10 11 |
# File 'lib/generator/entrypoint.rb', line 9 def apis @apis end |
Instance Method Details
#apis_with_latest_version ⇒ Object
23 24 25 26 27 |
# File 'lib/generator/entrypoint.rb', line 23 def apis_with_latest_version apis.group_by(&:name).transform_values do |api_list| find_latest_version(api_list.map(&:version)) end.sort.to_h end |
#generate ⇒ Object
15 16 17 |
# File 'lib/generator/entrypoint.rb', line 15 def generate File.write(file_path, render_template) end |
#required_libraries ⇒ Object
19 20 21 |
# File 'lib/generator/entrypoint.rb', line 19 def required_libraries apis.map(&:library_name).append("peddler/config", "peddler/token").sort end |