gamefic 3.2.0 → 3.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ac4f50caef9bd101bf90447e3ab289b05a29470e8f722ad391f7f0c9d8c4a921
4
- data.tar.gz: 926b7d40dc87036e3759a1a464d3db3c82187da4f829731d0d82b053ac5e52a4
3
+ metadata.gz: ea395014528ad74c93bfc7e33809a6b6ea24c0c8e2d37a2f6e0d7067eef564d1
4
+ data.tar.gz: ec2fcf7c80c501cf93c036bf2416f3f583755460d38aca464a5844eb2705151f
5
5
  SHA512:
6
- metadata.gz: 6a4b426b4703a29717dbcc59bfee2e3f5d3b1b2ceeb6121741f52111e5fe2d8165e0946f8c3a085f1a3c4094edab11e2966f751dbc3cfc1541809ebc3a9ad970
7
- data.tar.gz: ba3f3e82bd772ae392ffb23b056b62de2c1b5bebb0e810fea81bd59449d3e64c8c848f748803ac36f155ad3a2891b0e42d76ca48e4e74239a776670f19fdcc0e
6
+ metadata.gz: 7875f99a1d9d327f0251fdbeae15ddf31820091fd0cbdc43a1e5cbe7cabd8697057fe6333b84400d5e545fc31e3720c82ecc366dc2cc0066b71f3e2794b6e196
7
+ data.tar.gz: 91353478d4a994758c6fcc0a843335819cdb9086be9a29fdd429b333abdf58c4e2179e147b685a2f4720fb9e160ecd83ef5f4e5b4ab41a0ad582f583845f2843
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 3.2.1 - July 1, 2024
2
+ - MultipleChoice accepts shortened text
3
+ - Return Proxy::Agent from attr_seed and make_seed
4
+ - MultipleChoice skips finish blocks for invalid input
5
+
1
6
  ## 3.2.0 - April 9, 2024
2
7
  - Bug fix for marshal of structs in Opal
3
8
  - Add last_input and last_prompt at start of take
@@ -58,7 +58,8 @@ module Gamefic
58
58
  end
59
59
 
60
60
  def index_by_text
61
- options.find_index { |text| input.downcase == text.downcase }
61
+ matches = options.map.with_index { |text, idx| next idx if text.downcase.start_with?(input.downcase) }.compact
62
+ matches.first if matches.one?
62
63
  end
63
64
  end
64
65
  end
@@ -53,7 +53,7 @@ module Gamefic
53
53
  # @param props [Props::Default]
54
54
  # @return [void]
55
55
  def finish actor, props
56
- props.input = actor.queue.shift
56
+ props.input = actor.queue.shift&.strip
57
57
  end
58
58
 
59
59
  def run_start_blocks actor, props
@@ -20,6 +20,12 @@ module Gamefic
20
20
  actor.tell format(props.invalid_message, input: props.input)
21
21
  actor.recue
22
22
  end
23
+
24
+ def run_finish_blocks actor, props
25
+ return unless props.index
26
+
27
+ super
28
+ end
23
29
  end
24
30
  end
25
31
  end
@@ -104,7 +104,7 @@ module Gamefic
104
104
  def make_seed klass, **opts
105
105
  @count ||= 0
106
106
  seed { make(klass, **opts) }
107
- @count.tap { @count += 1 }
107
+ Proxy::Agent.new(@count.tap { @count += 1 })
108
108
  end
109
109
 
110
110
  # Seed an entity with an attribute method.
@@ -124,7 +124,7 @@ module Gamefic
124
124
  instance_variable_set("@#{name}", make(klass, **opts))
125
125
  self.class.define_method(name) { instance_variable_get("@#{name}") }
126
126
  end
127
- @count.tap { @count += 1 }
127
+ Proxy::Agent.new(@count.tap { @count += 1 })
128
128
  end
129
129
 
130
130
  if RUBY_ENGINE == 'opal'
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gamefic
4
- VERSION = '3.2.0'
4
+ VERSION = '3.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamefic
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-09 00:00:00.000000000 Z
11
+ date: 2024-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal