Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Turkish character support for core ruby methods. This gem provides support nearly all String
methods,
such as String#split
, String#match
, String#gsub
. It also provides support for Array#sort
and some
bonus methods like String#titleize
.
Ruby >= 2.7.0
Rails >= 6.0.0
Add this line to your application's Gemfile:
gem 'turkish_support'
And then execute:
$ bundle
Or install it yourself as:
$ gem install turkish_support
After the installation of the gem, you should follow these steps.
require 'turkish_support'
using TurkishSupport
line to a class or a module.Example usage inside a class:
require 'turkish_support'
class CanSpeakInTurkish
using TurkishSupport
def split_me_up(string, sep)
string.split(sep)
end
end
CanSpeakInTurkish.new.split_me_up('çar çarı çarşı', 'ç')
# ['ar', 'arı', 'arşı']
Note: You don't need to require, because it is already required by the rails.
using TurkishSupport
line to the top of the scope. using TurkishSupport
class TopModel < ApplicationRecord
# your code goes here
end
using TurkishSupport
line to the class or module. class CustomClass
using TurkishSupport
# your code goes here
end
'Cahit' <=> 'Çağla' # => -1
'Sıtkı' <=> 'Ömer' # => 1
'Eren' <=> 'Eren' # => 0
'c' <=> 'ca' # => -1
'd' > 'ç' # => true
'aha' >= 'ağa' # => true
'd' < 'ç' # => false
'ağa' <= 'aha' # => true
'Türkiye Cumhuriyeti'[/\w+/] # => "Türkiye"
'Çetin'[/[a-ğ]+/i] # => "Çe"
str = 'türkÇE desteĞİ'
str.capitalize # => "Türkçe desteği"
str.capitalize! # => "Türkçe desteği"
'sıtKI'.casecmp('SITkı') # => 0
str = 'İSMAİL'
str.downcase # => "ismail"
str.downcase! # => "ismail"
'ağa paşa ağa'.gsub(/\b[a-h]+\b/, 'bey') # => "bey paşa bey"
'?ç-!+*/-ğüı'.index(/\w+/) # => 1
'?ç-!+*/-ğüı'.index(/[a-z]+/, 2) # => 8
'Aşağı'.match(/\w+/)
# => #<MatchData "Aşağı">
'Aşağı Ayrancı'.match(/^\w+\s\w+$/)
# => #<MatchData "Aşağı Ayrancı">
'aüvvağğ öövvaağ'.match(/^[a-z]+\s[a-z]+$/)
# => #<MatchData "aüvvağğ öövvaağ">
'BAĞCIlar'.match(/[A-Z]+/)
# => #<MatchData "BAĞCI">
'Aşağı Ayrancı'.match(/\W+/)
# => #<MatchData "">
'Bağlarbaşı Çarşı'.partition(/\W+/) # => ["Bağlarbaşı", " ", "Çarşı"]
'Bağlarbaşı Çarşı Kalabalık'.rpartition(/\W+/)
# => ["Bağlarbaşı Çarşı", " ", "Kalabalık"]
'şç-!+*/-ğüı'.rindex(/\w+/, 7) # => 1
'Bağlarbaşı Çarşı Kalabalık'.scan(/[a-z]+/i)
# => ["Bağlarbaşı", "Çarşı", "Kalabalık"]
'Duayen'.slice(/[^h-ö]+/) # => "Duaye"
'Bağlarbaşı Çarşı Kalabalık'.split(/\W+/)
# => ["Bağlarbaşı", "Çarşı", "Kalabalık"]
'Bağlarbaşı Çarşı Kalabalık'.split(/[ç-ş]+/)
# => ["Ba", "a", "ba", " Ça", " Ka", "aba"]
'ağapaşaağa'.sub(/[a-h]+/, 'bey') # => "beypaşaağa"
'TuğÇE'.swapcase # => "tUĞçe"
'TuğÇE'.swapcase! # => "tUĞçe"
These methods are not core methods of ruby, but they are accepted as useful in most situations.
'türkÇE desteĞİ'.titleize # => "Türkçe Desteği"
'türkÇE desteĞİ'.titleize! # => "Türkçe Desteği"
# Parenthesis, quotes, etc. support
"rUBY roCkS... (really! 'tRUSt' ME)".titleize
# => "Ruby Rocks... (Really! 'Trust' Me)"
str = 'Bağcılar'
str.upcase # => "BAĞCILAR"
str # => "Bağcılar"
str.upcase! # => "BAĞCILAR"
str # => "BAĞCILAR"
%w(iki üç dört ılık iğne iyne).sort
# => ["dört", "ılık", "iğne", "iki", "iyne", "üç"]
To install this gem onto your local machine, run bundle exec rake install
.
Bug reports and pull requests are welcome on GitHub at https://github.com/sbagdat/turkish_support. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the TurkishSupport project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct]
FAQs
Unknown package
We found that turkish_support demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.