Releases: Ishotihadus/usamin
Releases · Ishotihadus/usamin
ナナの未来もまだ広がってます。次はどんな色になるか、楽しみです♪
Fixed a bug that prevented build on macOS.
v7.7.11
Fix ‘ruby_nonempty_memcpy’ is not a member of ‘std’
error on Ruby 2.7 and glibc.
I think this is because of a Ruby's ugly bug...
ウサミミ、今夜はちょっとだけお休みです。だって…お姫様、ですから
Add support for pattern matching in Ruby 2.7
json = <<JSON
{
"maekawa": "miku",
"osaki": ["tenka", "amana"],
"hisakawa": {"hayate": "haa", "nagi": "naa"}
}
JSON
data = Usamin.load(json)
#=> {"maekawa"=>"miku", "osaki"=>[...], "hisakawa"=>{...}}
case data
in maekawa:, hisakawa: {**sisters}
p maekawa
p sisters
end
# "miku"
# {:hayate=>"haa", :nagi=>"naa"}
Add useful methods
- Hash#invert
- Hash#to_proc
Add :symbolize_names option
- Usamin::parse
- UsaminValue#eval
- UsaminValue#eval_r
- JSON::parse, JSON::load (in overwriting module)
Fix methods' behaviors
- Usamin::Hash#fetch
- Usamin::Hash#merge
- Usamin::Array#[]
- Usamin::Array#fetch
- Usamin::Array#index
Set rapidjson::kParseIterativeFlag
as default (for security)
Set :recursive option to disable the flag.
This can cause fatal and unexpected problems.
Usamin.parse('[' * 1000000)
# Usamin::ParserError (Invalid value. Offset: 1000000)
Usamin.parse('[' * 1000000, recursive: true)
# SystemStackError (stack level too deep)
Usamin.parse('[' * 1000000, recursive: true)
# zsh: illegal hardware instruction bundle console
ウサミン星まで、魔法でワープできたらいいのにな…電車じゃなくて
Implement comparison methods in UsaminValue
Now you can make comparison of UsaminValues and use Hash with UsaminValue keys.
==
,===
eql?
,hash
[0, 1, 2] == Usamin.load('[0, 1, 2.0]')
#=> true
[0, 1, 2] == Usamin.load('[0, 1, 2]')
#=> true
[0, 1, 2] == Usamin.load('[1, 2, 3]')
#=> false
hash = {Usamin.load('[0, 1]') => 'hoge'}
hash[Usamin.load('[0, 1]')]
#=> "hoge"
Add some useful methods
inspect
=to_s
dig
flatten
reverse
,rotate
,rindex
(UsaminArray)
Fix bugs
- #2
- behavior of overwritten
JSON#load
with proc
サンタメイドアイドルです!ちょっと、足し算しすぎですかね?えへへ
Add merge to UsaminHash
Usamin.load('{"a": 3, "b": 4}').merge({'a' => 5, 'c' => 7})
#=> {"a"=>5, "b"=>4, "c"=>7}
Support to_h with a block on Ruby 2.6
json = '[{"name": "miku maekawa", "age": 15}, {"name": "nana abe", "age": 17}]'
Usamin.load(json).to_h{|e| [e['name'], e['age']]}
#=> {"miku maekawa"=>15, "nana abe"=>17}
Support SIMD operations
If available, -march=native, and -msse4.2 or -msse2 options are used on compilation.
Improve memory performance
v7.7.7
Improve memory management
ポンコツウサミン、かわいがってくださいねっ!
Improve stability and GC behaviors
v7.7.5
Fix double free bug
愛するプロデューサーさん!ずっとずっと、ナナを励まして、応援してくださいっ!10 年後も、その先も!
Nana Abe was elected as the 7th Cinderella Girl
The name of "Usamin" is derived from her.
Add some methods to UsaminValue
- Hash methods
- has_value? = value?
- key = index
- rassoc
- reject
- slice
- to_a
- transform_keys
- transform_values
- values_at
- Array methods
- compact
- include?
Fix some methods
- Array methods
- find_index = index
Symbols are also accepted as indexers of Hash
data = Usamin.load('{"a": 3, "b": 5}')
data[:a]
#=> 3
data.key?(:b)
#=> true
Improve Memory Management
あのとき感じた気持ちは、今でもハッキリ覚えています!そうじゃなかったら、ナナはステージに立っていないから。
Add some methods to UsaminValue
- Hash#fetch
- Hash#select
- Array#at
- Array#fetch
- Array#last
- Array#slice