Class: ViewModelGateway::XsdFilesGateway
- Inherits:
-
Object
- Object
- ViewModelGateway::XsdFilesGateway
- Defined in:
- lib/view_model_gateway/xsd_files_gateway.rb
Constant Summary collapse
- API_PATH =
"api/schemas/xml/".freeze
- XSD_DEFAULT_PATH =
"/api/schemas/xml/**/".freeze
Instance Attribute Summary collapse
-
#assessment_type ⇒ Object
readonly
Returns the value of attribute assessment_type.
-
#glob_path ⇒ Object
readonly
Returns the value of attribute glob_path.
-
#simple_type ⇒ Object
readonly
Returns the value of attribute simple_type.
-
#xsd_dir_path ⇒ Object
readonly
Returns the value of attribute xsd_dir_path.
Instance Method Summary collapse
-
#initialize(domain_arguments) ⇒ XsdFilesGateway
constructor
A new instance of XsdFilesGateway.
- #schema_version(file) ⇒ Object
- #xsd_files ⇒ Object
Constructor Details
#initialize(domain_arguments) ⇒ XsdFilesGateway
Returns a new instance of XsdFilesGateway.
8 9 10 11 12 13 |
# File 'lib/view_model_gateway/xsd_files_gateway.rb', line 8 def initialize(domain_arguments) @simple_type = domain_arguments.simple_type @assessment_type = domain_arguments.assessment_type @xsd_dir_path = domain_arguments.xsd_dir_path @dir_path = Dir.pwd if domain_arguments.gem_path.nil? || domain_arguments.gem_path.empty? end |
Instance Attribute Details
#assessment_type ⇒ Object (readonly)
Returns the value of attribute assessment_type.
3 4 5 |
# File 'lib/view_model_gateway/xsd_files_gateway.rb', line 3 def assessment_type @assessment_type end |
#glob_path ⇒ Object (readonly)
Returns the value of attribute glob_path.
3 4 5 |
# File 'lib/view_model_gateway/xsd_files_gateway.rb', line 3 def glob_path @glob_path end |
#simple_type ⇒ Object (readonly)
Returns the value of attribute simple_type.
3 4 5 |
# File 'lib/view_model_gateway/xsd_files_gateway.rb', line 3 def simple_type @simple_type end |
#xsd_dir_path ⇒ Object (readonly)
Returns the value of attribute xsd_dir_path.
3 4 5 |
# File 'lib/view_model_gateway/xsd_files_gateway.rb', line 3 def xsd_dir_path @xsd_dir_path end |
Instance Method Details
#schema_version(file) ⇒ Object
15 16 17 18 19 |
# File 'lib/view_model_gateway/xsd_files_gateway.rb', line 15 def schema_version(file) api_path_start = file.index(API_PATH) + API_PATH.length schema_version = file[api_path_start..].split("/").first sap_defined_in_rdsap_dir?(file) ? "#{schema_version}/SAP" : schema_version end |
#xsd_files ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/view_model_gateway/xsd_files_gateway.rb', line 21 def xsd_files files = if @xsd_dir_path.nil? || @xsd_dir_path.empty? case @assessment_type.downcase when "sap" sap_xsd_files when "rdsap" rdsap_xsd_files when "cepc" cepc_xsd_files end else @glob_path = "#{@dir_path}#{@xsd_dir_path}" Dir.glob(@glob_path) end raise ViewModelBoundary::XsdFilesNotFound, "No xsd files were found in #{@glob_path} directory" if files.nil? || files.empty? files end |