Class: Extension::Models::SpecificationHandlers::WebPixelExtensionUtils::ScriptConfigRepository

Inherits:
Object
  • Object
show all
Includes:
SmartProperties
Defined in:
lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config_repository.rb

Direct Known Subclasses

ScriptConfigYmlRepository

Instance Method Summary collapse

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config_repository.rb', line 10

def active?
  ctx.file_exist?(filename)
end

#filenameObject

Raises:

  • (NotImplementedError)


23
24
25
# File 'lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config_repository.rb', line 23

def filename
  raise NotImplementedError
end

#get!Object

Raises:

  • (RuntimeError.new("NoScriptConfigFile"))


14
15
16
17
18
19
20
21
# File 'lib/project_types/extension/models/specification_handlers/web_pixel_extension_utils/script_config_repository.rb', line 14

def get!
  raise RuntimeError.new("NoScriptConfigFile"), filename unless active?

  content = ctx.read(filename)
  hash = file_content_to_hash(content)

  from_h(hash)
end