blankity 0.11.0 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb74367673b591a115da493f40ebc58de31795567e08c7b24e7c97c51da256fc
4
- data.tar.gz: 8945066e28ec8457e1956ea751c3e0fcc24165c4cca2ac6bce662e66b1221752
3
+ metadata.gz: 9df0df8fd886ec2a81641d73014b4be0b527a660fcba506edb70678f37414125
4
+ data.tar.gz: 1d4bc2db327cfae657ea66ac46c713dcc8778a2a5e3e2f82bb2e71aeb706611e
5
5
  SHA512:
6
- metadata.gz: 521bbfc81372ae7f66dcefa14120075b47ad99ed7ad970576f01ed9fcdac07015be9005c755eed357ad54d3fc8332f7287c9f3cc9b76542e1f6a91a8df943c25
7
- data.tar.gz: 343abcf8d29f2d4e506e0ff9e4fd44b59057b4aec1654a86f2f8ebd6766a38606343a9f9d008bea2648b22b0730d7c245e14b822c3ed9822fa1b003cde68ac73
6
+ metadata.gz: '09a5c2ed58492f5943bd548726302f90296d392a1f654bc25507ab64fef10b298cd415f1b0063fc121dfeea48998ef5f7728ba39e5878e189a00c8b9403482ec'
7
+ data.tar.gz: ad5b3b4fafa74d980b7aa145b96accc7ea795fc1111b59c0bb22469d799ecaf6930b04fdd4a0b09600086ff24dfa54e0cbec9661a59066ba0662e6ba592cffba
data/README.md CHANGED
@@ -53,22 +53,22 @@ puts 'hello'.gsub(/[eo]/, Blankity::To.hash('e' => 'E', 'o' => 'O'))
53
53
  #=> hEllO
54
54
  ```
55
55
 
56
- The `Blankity::To` module is also a mixin!
56
+ You can include the `Blankity::To` module to get theeh `theo` method!
57
57
  ```ruby
58
58
  extend Blankity::To
59
59
 
60
- puts 'hello' + str(' world')
61
- exit int(0)
60
+ puts 'hello' + to.str(' world')
61
+ exit to.int(0)
62
62
 
63
63
  # Let's get crazy!
64
64
  system(
65
- hash(
66
- str('HELLO', hash: true) => str('WORLD')
65
+ to.hash(
66
+ to.str('HELLO', hash: true) => to.str('WORLD')
67
67
  ),
68
- ary(str('sh'), str('-sh')),
69
- str('-c'),
70
- str('echo $0 $HELLO $PWD'),
71
- chdir: path('/'),
68
+ to.ary(to.str('sh'), to.str('-sh')),
69
+ to.str('-c'),
70
+ to.str('echo $0 $HELLO $PWD'),
71
+ chdir: to.path('/'),
72
72
  )
73
73
  ```
74
74
 
@@ -38,6 +38,7 @@ module Blankity
38
38
 
39
39
  # Creates a new {BlankValue}, and defining singleton methods depending on the parameters
40
40
  #
41
+ # @param vars [Hash[interned, untyped]] an array of instance variables to define on +self+.
41
42
  # @param with [Array[interned]] a list of {Object} methods to define on +self+.
42
43
  # @param hash [bool] convenience argument, adds +hash+ and +eql?+ to +with+ so the resulting
43
44
  # type can be used as a key in +Hash+es
@@ -53,8 +54,8 @@ module Blankity
53
54
  # # Define a singleton method
54
55
  # p Blankity::Blank.new{ def cool?(other) = other == 3 }.cool?(3) #=> true
55
56
  #
56
- # @rbs (?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
57
- def initialize(with: [], hash: false, &block)
57
+ # @rbs (?vars: Hash[interned, untyped], ?with: Array[interned], ?hash: bool) ?{ () [self: instance] -> void } -> void
58
+ def initialize(vars: {}, with: [], hash: false, &block)
58
59
  # If `hash` is supplied, then add `hash` and `eql?` to the list of methods to define
59
60
  with |= %i[hash eql?] if hash
60
61
 
@@ -63,6 +64,11 @@ module Blankity
63
64
  __define_singleton_method__(method, ::Object.instance_method(method).bind(self))
64
65
  end
65
66
 
67
+ # Assign all instance variables
68
+ vars.each do |key, value|
69
+ ::Kernel.instance_method(:instance_variable_set).bind_call(self, key, value)
70
+ end
71
+
66
72
  # If a block's provided, then `instance_exec`
67
73
  __instance_exec__(&__any__ = block) if block
68
74
  end
@@ -2,5 +2,5 @@
2
2
  # rbs_inline: enabled
3
3
 
4
4
  module Blankity
5
- VERSION = '0.11.0'
5
+ VERSION = '1.0.0'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blankity
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Westerman
@@ -56,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubygems_version: 3.7.0.dev
59
+ rubygems_version: 4.0.3
60
60
  specification_version: 4
61
61
  summary: Provides "blank" objects which only supply conversion methods
62
62
  test_files: []