def include_scopes
      @states.each do |state|
        state_name = state.name.to_s
        if @klass.respond_to?(state_name)
          fail InvalidMethodOverride,
               "Transitions: Can not define scope `#{state_name}` because there is already"\
               'an equally named method defined - either rename the existing method or the state.'
        end
        scope = @klass.instance_exec { -> { where(state_machine.attribute_name => state_name) } }
        @klass.scope state_name, scope
      end
    end
def include_scopes
      @states.each do |state|
        state_name = state.name.to_s
        if @klass.respond_to?(state_name)
          fail InvalidMethodOverride,
               "Transitions: Can not define scope `#{state_name}` because there is already"\
               'an equally named method defined - either rename the existing method or the state.'
        end
        scope = @klass.instance_exec { -> { where(state_machine.attribute_name => state_name) } }
        @klass.scope state_name, scope
      end
    end
:reek:TooManyStatements: { max_statements: 7 }