Ruuuby
flavored modifications & extensions for increased quality of Ruby coding life
Usage
for | use |
---|---|
Gemfile |
gem 'ruuuby', '~> 0.0.37' |
ruby scripts | require 'ruuuby' |
gem url | https://rubygems.org/gems/ruuuby |
changelog | https://github.com/utarsuno/ruuuby/blob/master/CHANGELOG.md |
Example
# true, true
โ(1787569) == 1337
โ(โ(-1337.0^โด)) == 1337
# true, true, true
๐ฝ == 1 + (๐ฝ^โปยน)
๐ฝ == 2 * sin(ฮธยฐ(54))
๐ฝ == (ฮธ๐ฝ(1) - แด) / แด
# true, true
ฮธยฐ(180) == ฮธ๐ฝ(0.5)
ฮธแต(200) == ฮธสณ(ฯ)
# true, true, false
'b'.โ? 'abc'
'abc'.โ? 'd'
'd'.โ? 'abc'
# true, false
elements_a = [1, 'a', 2, nil, [], 2]
elements_b = [nil, 2, 2, 'a', 1, []]
[elements_a.โโ(elements_b), elements_a == elements_b]
# true, true, true, true
['snake_case'.๐?, 'AHHH_CAPITALS'.๐โฌ?, 'UpperCaseCamel'.๐ซ?, 'lowerCaseCamel'.๐ซโฌ?]
# [false, true, false, true]
[โ.โ?(-5), โค.โ?(7.0), โ.โ?(โ), โ.โ?(Rational(2, 3))]
# [1, 4, 2]
[1, 2, 3].โ [3, 4]
# [4]
[2, 3, 4].โ [1, 2, 3]
# [true, false]
data = {haaallo: 'wooorld', ye: 'ee'}
[data.โ๐?(:haaallo), data.โ๐?(:๐๏ธ๐
๐๏ธ)]
# stdout ->
# 'world'
# 'hello'
['world', 1337, 'hello', 'abc'.โ๏ธ].โ{|x| puts x if x.str? && !x.โ๏ธ?}
# stdout ->
# 'hello'
# 'world'
['world', 1337, 'hello', 'abc'.โ๏ธ].โฉโ{|x| puts x if x.str? && !x.โ๏ธ?}
โ ๏ธ : documentation & test-coverage not fully synced atm
Language Changes:
Operations Supported (patched in)
(
โ ๏ธ wip): raising to powers(via-superscripts:โปโน...โปยน, โฐ, ยน...โน
) with operator(^
)
class(es)/obj | example | (at least partially) utilizing C-extension? (java-wip) |
notes |
---|---|---|---|
Integer |
1337^ยฒ |
-coexists with Integer 's pre-existing bitwise XOR functionality- performance penalties : up to 80% slower than using operator(** ) |
|
Float |
1337.1337^ยฒ |
performance penalties : up to 90% slower than using operator(** ) |
|
Rational |
3/4r^ยฒ |
performance penalties : up to 105% slower than using operator(** ) |
|
Complex |
1337i^ยฒ |
performance penalties : up to 85% slower than using operator(** ) |
|
BigDecimal |
inc |
inc |
inc |
ThetaAngle |
inc |
inc |
outputs to unit: steradian (depending on input) |
Quaternion |
inc |
inc |
|
โฎ |
inc |
inc |
TOPLEVEL_BINDING Modifications:
(global ) func(s) added |
notes | as C-extension? (java-wip) |
---|---|---|
โฎ , logโ , logโ , logโโ โ , โ , ฯ , แด ยผ , ยฝ , ยพ , โ
, โ
, โ
,โ
,โ
,โ
,โ
,โ
, โ
, โ
, โ
, โ
, โ
, โ
โ , โโ , ฮณ sin , cos , tan , arcsin , arccos , arctan , cot , csc , sec , sinยฒ , cosยฒ
|
(f10 , f17 ) |
|
๐ฝ |
(f10 ): aliases Kernel
|
|
๐ , ๐ , ๐๏ธ
|
- (f12 ) aliases to:File , Dir
|
|
๐
, ๐ , ๐
๐
|
- (f26 ) aliases to:Date , Time , DateTime
|
|
ฮธยฐ , ฮธสณ , ฮธแต , ฮธ๐ฝ
|
f27 |
Module Modifications:
instance methods for Kernel will act as 'globally-scoped functions'; meaning they can essentially can be called from anywhere with caller of the method ignored for all contextes
module(s) | func(s) added | as C-extension? (java-wip) |
notes |
---|---|---|---|
Kernel |
๐ |
(f03 ) |
|
Kernel |
๐ฝ_previous_โจ |
(f10 ) |
|
Kernel |
โmodule? , โclass? { static }โโจ_alias? , โโจ?
|
||
Module |
{static }โจ_add_aliases
|
||
Math |
{static }relative_ฮ , ฯยณ_is_pythagorean? , ฯยฒ_in_golden_ratio? , ฯยฒ_in_super_golden_ratio?
|
(f17 ) |
|
Math |
{static }cot , csc , sec , sinยฒ , cosยฒ
|
(f17 ) |
Class Modifications:
class(es) | func(s) added | as C-extension? (java-wip) |
notes |
---|---|---|---|
File , Dir
|
{static }โ?
|
(f12 ) |
|
File |
{static } dirnameยฒ , dirnameยณ , dirnameโด replace_expr_with , replace_expr_with! , insert_line_before_expr
|
(f12 ) |
|
Dir |
ฮทฬ_paths |
(f12 ) |
|
File , Dir , ENV
|
โ
? |
(f04 ) |
|
Object |
ary? , bool? , hsh? , int? , flt? , num? , str? , chr? , sym? , ฮธ? class? , module? , nucleotide?
|
(f06 ) |
|
Object |
singleton? , โ ๐boolโ , ๐intโ , ๐aryโ , ๐strโ , ๐symโ , ๐ฮธโ
|
(f06 ) |
|
Array , Set
|
remove_empty! |
|
(f07 ) |
String |
โป๏ธโต , โป๏ธโถ , โป๏ธโถโ downcase? {โฌ? }upcase? {โฌ? } |
(f08 ) |
|
String |
๐ซ? , ๐ซโฌ? , to_๐ซ ๐โฌ? , ๐? , to_๐
|
(f24 ) |
|
String |
as_utf8 , iso8601? , to_iso8601 , as_iso8601
|
||
Array , String
|
ฮทฬ! |
(f08 ) |
|
Array |
[frequency_counts , ๐ ][ equal_contents? , โโ ][ disjunctive_union , โ ]โ
|
(f09 ) |
|
Module , String
|
โ? , โ? , โ? , โ?
|
(f09 ) |
|
Enumerable |
โ? , โฯยฒโฮป๐โแตขุแตขโโโ
|
(f09 , f10 ) |
|
Array , String
|
>> |
(f05 ) |
|
String |
digit? , to_num , to_num?
|
(f21 ) |
|
Array |
end_with? , start_with?
|
(f08 ) |
|
String , Array
|
ensure_start! , ensure_ending!
|
(f08 ) |
|
NilClass |
empty? |
- - ( f04 ) |
|
Integer |
finite? , infinite?
|
(f11 ) |
|
Numeric |
โ? |
(f11 ) |
|
Float |
โโ , โโ?
|
(f17 ) |
Aliases:
for | base method(s) reference(s) | alias(es) | notes |
---|---|---|---|
Kernel |
raise , rand
|
๐ , ๐ฒ
|
(f10 ) |
Object |
object_id , โฃ , freeze , frozen? , define_singleton_function
|
๐ , class , [โ๏ธ , โ ], [โ๏ธ? , โ? ], define_singleton_โจ
|
(f10 ) |
Class |
new |
๐ |
(f10 ) |
Array , Set
|
remove_empty! |
โป๏ธโ
! |
(f10 ) |
String , Symbol
|
upcase , downcase
|
โฌ , โฌ
|
(f10 ) |
String |
upcase! , downcase!
|
โฌ! , โฌ!
|
(f10 ) |
Object |
protected_instance_methods , private_methods
|
๐ก๏ธfuncs , ๐funcs
|
(f01 ,f02 ) |
Array |
frequency_counts , disjunctive_union , equal_contents? โฉโ
|
๐ , โ , โโ reverse_each
|
(f10 ) |
Module |
const_defined? , private_method_defined?
|
โconst? , โ๐func?
|
|
Module |
private , private_constant protected , protected_method_defined?
|
๐ , ๐constantsโถ ๐ก๏ธ , โ๐ก๏ธfunc?
|
(f01 )( f02 ) |
Array , Hash , Set
|
each |
โ |
(f10 ) |
Array , String
|
reverse , reverse!
|
โฉ , โฉ!
|
(f10 ) |
Enumerable |
map , each_with_index
|
โจ , โโแตข
|
(f10 ) |
Hash |
key? |
โ๐? |
(f10 ) |
NilClass , Hash , Array , String , Set
|
empty? |
โ
? |
(f04 ) |
String , Array , Set , Hash
|
length |
๐ |
(f03 ) |
Proc |
arity |
๐ |
(f03 ) |
Code Base Statistics:
category | attribute | value | desc. |
---|---|---|---|
QA | unit | 1009 | # of tests (solely relating to core functionality) |
QA | performance | 233 | # of tests (solely relating to performance) |
QA | DB | 176 | # of tests (solely relating to the database) |
CI | audits | 114 | # of tests (solely relating to non-functionality based audits) |
CI | locale | 28 | # of tests (solely relating to local-dev-setup) |
structure | features | ~35 | # of distinct features (that are categorized & tracked) wip
|
coverage | LOCs | ??? | wip |
coverage | runtime | ??? | wip |
coverage | documentation | ??? | wip |
Gems:
gem | version | :development, :runtime | category |
---|---|---|---|
tty-command |
0.9.0 |
|
CLI |
rugged |
1.0.0 |
|
GIT |
rdoc |
6.2.1 |
|
DOC |
bundler |
2.1.4 |
|
CI |
rspec |
3.9.0 |
|
QA |
rspec-benchmark |
0.5.1 |
|
QA |
rake |
13.0.1 |
|
EXT |
rake-compiler |
1.1.0 |
|
EXT |
sqlite3 |
1.4.2 |
|
DB |
activerecord |
5.2.4.1 |
|
DB |
schema_plus_foreign_keys |
0.1.8 |
|
DB |
Commands
General Tasks:
preface | cmd | description |
---|---|---|
bundle exec rake |
rdoc |
generate documentation coverage report |
bundle exec rake |
install |
install gem onto local machine |
bundle exec rake |
compile |
compile any native C-extensions with code changes |
bundle exec rake |
release |
push git version tags and publish gem to Rubygems |
bin/ |
audit |
general all-around build & health check |
bin/ |
audit_db audit_quick audit_quickest audit_all_but_performance
|
similar to above but for targeted portions |
bin/ |
setup |
install dependencies |
bin/ |
console |
interactive console for easier experimenting |
gem |
server |
host interactive web-page at http://0.0.0.0:8808 to see documentation for currently installed gems |
Testing Tasks:
preface | cmd | w/ warnings? | description |
---|---|---|---|
bundle exec rake |
rspec_unit |
run all unit-tests except tags: {audit, performance, db} | |
bundle exec rake |
rspec_db |
run only db based unit-tests | |
bundle exec rake |
rspec_audit |
run only audit based unit-tests | |
bundle exec rake |
rspec_performance |
run only performance based unit-tests | |
bundle exec rake |
rspec_all |
run all unit-tests |
Project Layout:
directory | description of contents |
---|---|
app |
currently only holds ORM definitions |
bin |
executable files |
db |
database schema , seed , and migrations
|
ext |
C portion of this Gem's code (and future location for JRuby-extensions ) |
help |
any helpful documentation & notes
|
lib |
Ruuuby portion of this Gem's code
|
spec |
RSpecs (unit tests + other QA and Audits ) |
Contributing
https://github.com/utarsuno/ruuuby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
Bug reports and pull requests are welcome on GitHub atLicense
MIT License.
The gem is available as open source under the terms of theCode of Conduct
code of conduct.
Everyone interacting in the Ruuuby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the