All files / src/env zcl_abapgit_feature.clas.abap

95.83% Statements 46/48
50% Branches 1/2
100% Functions 0/0
95.83% Lines 46/48

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 491x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x     1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
CLASS zcl_abapgit_feature DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC.
 
  PUBLIC SECTION.
 
    " For dependency injection/testing, use the following
    " zcl_abapgit_persist_factory=>get_settings( )->read( )->set_experimental_features( )
 
    CLASS-METHODS is_enabled
      IMPORTING
        !iv_feature   TYPE string OPTIONAL
      RETURNING
        VALUE(rv_run) TYPE abap_bool.
 
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.
 
 
 
CLASS zcl_abapgit_feature IMPLEMENTATION.
 
 
  METHOD is_enabled.
 
    DATA:
      lv_features TYPE string,
      lt_features TYPE string_table.
 
    IF zcl_abapgit_factory=>get_environment( )->is_merged( ) = abap_true.
      RETURN.
    ENDIF.
 
    lv_features = zcl_abapgit_persist_factory=>get_settings( )->read( )->get_experimental_features( ).
    CONDENSE lv_features NO-GAPS.
 
    rv_run = boolc( lv_features = abap_true ).
 
    IF iv_feature IS NOT INITIAL.
      SPLIT lv_features AT ',' INTO TABLE lt_features.
      READ TABLE lt_features TRANSPORTING NO FIELDS WITH TABLE KEY table_line = iv_feature.
      rv_run = boolc( rv_run = abap_true OR sy-subrc = 0 ).
    ENDIF.
 
  ENDMETHOD.
ENDCLASS.