y_support 2.0.38 → 2.0.39

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +52 -19
  3. data/lib/y_support/version.rb +1 -1
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 162144f60bcef05c8ffbedaf26734b109de7baf9
4
- data.tar.gz: 06d085bb97dd3ff85ff814b375b08b9cf24aa8f8
3
+ metadata.gz: ed2dababbc49adf84a88b8412d7d8a52d2106c5c
4
+ data.tar.gz: afbdb0ab6c8a7dada0c501a4757b01b850afeba6
5
5
  SHA512:
6
- metadata.gz: 5371cd77eccef072a5fb9e49d3964fb7f71aa2e0c4ad515f8d884bcdd475a156ea7f908f111b9b02eaf4aad5a47b171360f0543f414f1f374905ce20153bef2a
7
- data.tar.gz: 905f4e5b783484bc41dcc21b220a6e3a3a0692f5712b9e8d4d701f1556b042d647a8473e5d2d2b9d145b2b94c204b2c61a75b37dd62a74e297fb68ac8d2fcf5a
6
+ metadata.gz: 52cc87bbe3e00e2ba464787745f4f2ea246423c7f0e530666c05aa88397c1cefb2dddfcb6d61dc4ed0e810f32b97053bad2cc7ea2cfa9715e4592f8627dbaccb
7
+ data.tar.gz: 25f0078f9df59bbec95f830f5fb3702ad7e6e2b046e5f420bd64ae73437ae2bc3a8fc876ea529d9c2d978efcf7b8f6f6699ee4013240dcc3b7e3465e0f20b6c0
data/README.md CHANGED
@@ -1,24 +1,57 @@
1
1
  # YSupport
2
2
 
3
- Common support library for Y* gems.
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'y_support'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install y_support
18
-
19
- ## Usage
20
-
21
- Require 'y_support/all', or require 'y_support/something', and use it.
3
+ `YSupport` is a common support library for Y* gems (`y_petri`, `yzz`,
4
+ `y_nelson`, `sy`...). At the moment, it is a collection of all and sundry
5
+ helpful methods, which can be divided as follows
6
+
7
+ * `NameMagic` (`lib/name_magic.rb`) -- its main feature is that it allows
8
+ constant magic known from classes to work with any objects.
9
+ * Miscellaneous helpful methods (`lib/misc.rb`)
10
+ * Typing (runtime assertions, `lib/typing.rb`)
11
+ * Other smaller components:
12
+ - `unicode.rb` -- shortcut letter for class (ç), singleton class (ⓒ) etc.
13
+ - `null_object.rb`
14
+ - `try.rb` -- a different kind of `#try` method
15
+ - several other small fry components
16
+
17
+ ## NameMagic
18
+
19
+ Try for example:
20
+ ```ruby
21
+ require 'y_support/name_magic'
22
+
23
+ class Animal
24
+ include NameMagic
25
+ def sound; "squeak" end
26
+ def speak; 2.times { puts sound.capitalize << ?! } end
27
+ end
28
+
29
+ class Dog < Animal; def sound; "bark" end end
30
+ class Cat < Animal; def sound; "meow" end end
31
+
32
+ Pochi = Dog.new
33
+ unnamed_kitten = Cat.new
34
+ ```
35
+ Mixin `NameMagic` makes class `Animal` keep registry of its instances:
36
+ ```ruby
37
+ Animal.instances.names
38
+ #=> [:Pochi, nil]
39
+ Tama = unnamed_kitten
40
+ Animal.instances.names
41
+ #=> [:Pochi, :Tama]
42
+ Cheburashka = Animal.new
43
+ Animal.instances.names
44
+ #=> [:Pochi, :Tama, :Cheburashka]
45
+ Dog.instances.names
46
+ #=> [:Pochi]
47
+ Animal.instances.each &:speak
48
+ Dog.instances.each &:speak
49
+ Cat.instances.each &:speak
50
+ ```
51
+
52
+ ## Other components
53
+
54
+ Read the documentation of the individual methods.
22
55
 
23
56
  ## Contributing
24
57
 
@@ -1,4 +1,4 @@
1
1
  module YSupport
2
- VERSION = "2.0.38"
2
+ VERSION = "2.0.39"
3
3
  DEBUG = false
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: y_support
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.38
4
+ version: 2.0.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - boris