Sha256: 0ae0b7fb8bc03bdd696957ac70e26fc6cca0eae06677449bf19f6f130d09a965

Contents?: true

Size: 984 Bytes

Versions: 19

Compression:

Stored size: 984 Bytes

Contents

# frozen_string_literal: true

# StringActions Module
module KepplerFrontend
  module Concerns
    module StringActions
      extend ActiveSupport::Concern
      private

      def not_special_chars
        chars = ('a'..'z').to_a << '_'
        chars << ':'
      end

      def without_special_characters
        self.name.gsub!(' ', '_')
        special_characters.each { |sc| self.name.gsub!(sc, '') }
      end

      def has_a_special_characters(name)
        chars = name.split('')
        chars.each do |c| 
          if special_characters.include?(c)
            return true
          else
            return false
          end
        end
      end

      def special_characters
        [
          '/', '.', '@', '"', "'", '%', '&', '$',
          '?', '¿', '/', '=', ')', '(', '#', '{',
          '}', ',', ';', ':', '[', ']', '^', '`',
          '¨', '~', '+', '-', '*', '¡', '!', '|',
          '¬', '°', '<', '>', '·', '½'
        ]
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
keppler-2.1.22 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.21 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.20 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.19 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.18 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.17 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.16 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.15 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.14 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.13 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.12 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.11 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.10 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.9 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.8 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.7 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.6 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.5 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb
keppler-2.1.4 installer/core/rockets/keppler_frontend/app/models/keppler_frontend/concerns/string_actions.rb