Class: Modulorails::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/modulorails/data.rb

Overview

Author: Matthieu ‘ciappa_m’ Ciappara This holds the data gathered by the gem. Some come from the configuration by the gem’s user. Some are fetched dynamically.

Constant Summary collapse

ATTRIBUTE_KEYS =

All the data handled by this class

%i[
  name main_developer project_manager repository type rails_name ruby_version rails_version
  bundler_version modulorails_version adapter db_version adapter_version webpacker_version
  importmap_version jsbundling_version
  production_url staging_url review_base_url
  environment_name
].freeze

Instance Method Summary collapse

Constructor Details

#initializeData

Returns a new instance of Data.



24
25
26
27
28
29
30
# File 'lib/modulorails/data.rb', line 24

def initialize
  initialize_from_constants
  initialize_from_configuration
  initialize_from_database
  initialize_from_gem_specs
  initialize_from_git
end

Instance Method Details

#to_paramsHash

Returns The payload for the request to the intranet.

Returns:

  • (Hash)

    The payload for the request to the intranet

Author:

  • Matthieu ‘ciappa_m’ Ciappara



40
41
42
43
44
45
46
47
48
49
# File 'lib/modulorails/data.rb', line 40

def to_params
  {
    'name'            => @name,
    'main_developer'  => @main_developer,
    'project_manager' => @project_manager,
    'repository'      => @repository,
    'app_type'        => @type,
    'project_data'    => to_project_data_params
  }
end

#to_sString

Returns Text version of the data.

Returns:

  • (String)

    Text version of the data

Author:

  • Matthieu ‘ciappa_m’ Ciappara



34
35
36
# File 'lib/modulorails/data.rb', line 34

def to_s
  ATTRIBUTE_KEYS.map { |key| "#{key}: #{send(key)}" }.join(', ')
end