abapGit/src/env/zcl_abapgit_feature.clas.abap
Marc Bernard 294da99e85
Reorg packages (2) (#6699)
Co-authored-by: Lars Hvam <larshp@hotmail.com>
2023-12-14 09:35:49 +01:00

49 lines
1.1 KiB
ABAP

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.