Class: Generator::Entrypoint
- Inherits:
-
Object
- Object
- Generator::Entrypoint
- Includes:
- Utils
- 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
Methods included from Utils
Constructor Details
#initialize(apis) ⇒ Entrypoint
Returns a new instance of Entrypoint.
14 15 16 |
# File 'lib/generator/entrypoint.rb', line 14 def initialize(apis) @apis = apis end |
Instance Attribute Details
#apis ⇒ Object (readonly)
Returns the value of attribute apis.
12 13 14 |
# File 'lib/generator/entrypoint.rb', line 12 def apis @apis end |
Instance Method Details
#apis_with_latest_version ⇒ Object
26 27 28 29 30 |
# File 'lib/generator/entrypoint.rb', line 26 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
18 19 20 |
# File 'lib/generator/entrypoint.rb', line 18 def generate File.write(file_path, render_template) end |
#required_libraries ⇒ Object
22 23 24 |
# File 'lib/generator/entrypoint.rb', line 22 def required_libraries apis.map(&:library_name).append("peddler/token").sort end |