Class: Evva::Config
- Inherits:
-
Object
- Object
- Evva::Config
- Defined in:
- lib/evva/config.rb
Constant Summary collapse
- CONFIG_STRUCT =
{ type: Hash, elements: { type: { type: String }, data_source: { type: Hash, elements: { type: { type: String } } }, out_path: { type: String }, event_file_name: { type: String }, event_enum_file_name: { type: String }, people_file_name: { type: String }, people_enum_file_name: { type: String }, destinations_file_name: { type: String }, package_name: { type: String } } }.freeze
- GOOGLE_SHEET_STRUCT =
{ type: Hash, elements: { type: { type: String }, events_url: { type: String }, people_properties_url: { type: String }, enum_classes_url: { type: String }, } }.freeze
- DICTIONARY_STRUCT =
{ "google_sheet" => GOOGLE_SHEET_STRUCT }.freeze
Instance Method Summary collapse
- #data_source ⇒ Object
- #destinations_file_name ⇒ Object
- #event_enum_file_name ⇒ Object
- #event_file_name ⇒ Object
-
#initialize(hash:) ⇒ Config
constructor
A new instance of Config.
- #out_path ⇒ Object
- #package_name ⇒ Object
- #people_enum_file_name ⇒ Object
- #people_file_name ⇒ Object
- #special_enum_file_name ⇒ Object
- #to_h ⇒ Object
- #type ⇒ Object
Constructor Details
#initialize(hash:) ⇒ Config
Returns a new instance of Config.
3 4 5 6 7 8 9 10 11 12 |
# File 'lib/evva/config.rb', line 3 def initialize(hash:) @hash = hash.deep_symbolize @hash.validate_structure!(CONFIG_STRUCT) unless dict_struct = DICTIONARY_STRUCT[@hash[:data_source][:type]] raise ArgumentError, "unknown data source type '#{@hash[:data_source][:type]}'" end @hash[:data_source].validate_structure!(dict_struct) end |
Instance Method Details
#data_source ⇒ Object
18 19 20 |
# File 'lib/evva/config.rb', line 18 def data_source @hash[:data_source] end |
#destinations_file_name ⇒ Object
50 51 52 |
# File 'lib/evva/config.rb', line 50 def destinations_file_name @hash[:destinations_file_name] end |
#event_enum_file_name ⇒ Object
34 35 36 |
# File 'lib/evva/config.rb', line 34 def event_enum_file_name @hash[:event_enum_file_name] end |
#event_file_name ⇒ Object
30 31 32 |
# File 'lib/evva/config.rb', line 30 def event_file_name @hash[:event_file_name] end |
#out_path ⇒ Object
26 27 28 |
# File 'lib/evva/config.rb', line 26 def out_path @hash[:out_path] end |
#package_name ⇒ Object
54 55 56 |
# File 'lib/evva/config.rb', line 54 def package_name @hash[:package_name] end |
#people_enum_file_name ⇒ Object
42 43 44 |
# File 'lib/evva/config.rb', line 42 def people_enum_file_name @hash[:people_enum_file_name] end |
#people_file_name ⇒ Object
38 39 40 |
# File 'lib/evva/config.rb', line 38 def people_file_name @hash[:people_file_name] end |
#special_enum_file_name ⇒ Object
46 47 48 |
# File 'lib/evva/config.rb', line 46 def special_enum_file_name @hash[:special_enum_file_name] end |
#to_h ⇒ Object
14 15 16 |
# File 'lib/evva/config.rb', line 14 def to_h @hash end |
#type ⇒ Object
22 23 24 |
# File 'lib/evva/config.rb', line 22 def type @hash[:type] end |