gamefic 4.1.1 → 4.1.2

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: 0e888ff6feb58de6f23f2727cc23fed710935f1876ea393ee84c19c2252166c8
4
- data.tar.gz: 314a944a945ffb5c51cdc37b842452653408c5a902722b91585cb036b82ee8b7
3
+ metadata.gz: e90aabf8b81551f127b57f7a70f62aa0cc92c0bc8e346ffe5056260678b0ae86
4
+ data.tar.gz: 7607b66f7927acd8310ba3a0be94834102c8fcf1d7458c3bbd950de44cabd9b0
5
5
  SHA512:
6
- metadata.gz: aa90ce26213fbeec901719fcb1d099c14f627bb5c1ac94eefaa8c883c06f1d48bf6a269c4f259d67d6b63d35d6855a67cf5e3b0a22f3be23b3dde955afd47a3d
7
- data.tar.gz: e237330cd06ca31b3b53ae00b2d774aa9f5b1ab6a307efcc179a07c77928d0e409f3c5237ec94739583c1b835cb8600d81c7c0b2b33ceaa4ced2f3b331f8a081
6
+ metadata.gz: c84cc7bf2a99438d3b61a11197b43c51d3577413f0249ad44360bb7b97520b3c1fec48e39f833c0bd999ae5de3a1b934e2d4b17983544840bccb861504207eca
7
+ data.tar.gz: 3c512256a34fa09048e79216a1defdc8fa076d89d2bb4549b1bbe35fbaae5c272eb156b84d5daa7f310a800d64217c49cb74c351115e7de8cd8ca25fd57382d5
@@ -22,7 +22,7 @@ jobs:
22
22
  runs-on: ubuntu-latest
23
23
  strategy:
24
24
  matrix:
25
- ruby-version: ['2.7', '3.0', '3.1', '3.3']
25
+ ruby-version: ['2.7', '3.0', '3.1', '3.3', '3.4']
26
26
 
27
27
  steps:
28
28
  - uses: actions/checkout@v3
data/.rubocop.yml CHANGED
@@ -1,4 +1,4 @@
1
- Metrics/LineLength:
1
+ Layout/LineLength:
2
2
  Description: 'Limit lines to 80 characters.'
3
3
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
4
4
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 4.1.2 - May 25, 2025
2
+ - Seed unreferenced entities
3
+ - Ensure seed uniqueness
4
+ - Add base64 dependency
5
+
1
6
  ## 4.1.1 - March 2, 2025
2
7
  - Warn for duplicate chapters
3
8
  - YARD documentation
data/Rakefile CHANGED
@@ -15,7 +15,8 @@ task :default => :spec
15
15
 
16
16
  Opal::RSpec::RakeTask.new(:opal) do |_, config|
17
17
  Opal.append_path File.join(__dir__, 'lib')
18
+ Opal.append_path File.join(__dir__, 'spec', 'fixtures', 'modular')
18
19
  config.default_path = 'spec'
19
20
  config.pattern = 'spec/**/*_spec.rb'
20
- config.requires = ['opal_helper']
21
+ config.requires = ['opal_helper', 'modular_test_script', 'modular_test_plot']
21
22
  end
data/gamefic.gemspec CHANGED
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  s.required_ruby_version = '>= 2.7.0'
23
23
 
24
+ s.add_runtime_dependency 'base64', '~> 0.1'
24
25
  s.add_runtime_dependency 'yard-solargraph', '~> 0.1'
25
26
 
26
27
  s.add_development_dependency 'opal', '~> 1.7'
@@ -66,6 +66,8 @@ module Gamefic
66
66
  narrative_set.flat_map(&:after_commands)
67
67
  end
68
68
 
69
+ # @sg-ignore Type checker has trouble reconciling return type of `Set#each`
70
+ # with unresolved `generic<R>` of `Enumerable#each`
69
71
  def each(&block)
70
72
  narrative_set.each(&block)
71
73
  end
@@ -44,6 +44,7 @@ module Gamefic
44
44
 
45
45
  # Subclasses can override this method to handle additional configuration.
46
46
  #
47
+ # @return [void]
47
48
  def configure; end
48
49
 
49
50
  class << self
@@ -14,16 +14,16 @@ module Gamefic
14
14
 
15
15
  # Cast a player character in the plot.
16
16
  #
17
- # @param character [Actor]
18
- # @return [Actor]
17
+ # @param character [Actor, Active]
18
+ # @return [Actor, Active]
19
19
  def cast(character = plot.introduce)
20
20
  plot.cast character
21
21
  end
22
22
 
23
23
  # Uncast a player character from the plot.
24
24
  #
25
- # @param character [Actor]
26
- # @return [Actor]
25
+ # @param character [Actor, Active]
26
+ # @return [Actor, Active]
27
27
  def uncast(character)
28
28
  plot.uncast character
29
29
  end
@@ -77,7 +77,7 @@ module Gamefic
77
77
  # gets sorted in descending order of their responses' overall precision,
78
78
  # so the action with the highest precision gets attempted first.
79
79
  #
80
- # @return [Integer]
80
+ # @return [::Integer]
81
81
  def precision
82
82
  @precision ||= calculate_precision
83
83
  end
@@ -18,7 +18,7 @@ module Gamefic
18
18
  # @param selection [Array<Entity>]
19
19
  # @param token [String]
20
20
  # @param use [Array<Class<Scanner::Base>>]
21
- # @return [Result]
21
+ # @return [Result, nil]
22
22
  def self.scan(selection, token, use = processors)
23
23
  result = nil
24
24
  use.each do |processor|
@@ -12,8 +12,8 @@ module Gamefic
12
12
  attr_reader :actor, :narrative, :props, :context
13
13
 
14
14
  # @param actor [Actor]
15
- # @param narrative [Narrative]
16
- # @param props [Props::Default]
15
+ # @param narrative [Narrative, nil]
16
+ # @param props [Props::Default, nil]
17
17
  def initialize(actor, narrative = nil, props = nil, **context)
18
18
  @actor = actor
19
19
  @narrative = narrative
@@ -11,11 +11,13 @@ module Gamefic
11
11
  # @return [Scene::Conclusion]
12
12
  attr_reader :default_conclusion
13
13
 
14
+ # @param [Scene::Base]
14
15
  def select_default_scene(klass)
15
16
  scene_classes.add klass
16
17
  @default_scene = klass
17
18
  end
18
19
 
20
+ # @param [Scene::Conclusion]
19
21
  def select_default_conclusion(klass)
20
22
  scene_classes.add klass
21
23
  @default_conclusion = klass
@@ -61,7 +63,8 @@ module Gamefic
61
63
  #
62
64
  # @yieldparam [Gamefic::Actor]
63
65
  # @yieldparam [Props::Default]
64
- # @return [Symbol]
66
+ # @yieldreceiver [Object<self>]
67
+ # @return [void]
65
68
  def introduction(&start)
66
69
  introductions.push start
67
70
  end
@@ -88,7 +91,7 @@ module Gamefic
88
91
  # @yieldreceiver [Class<Scene::MultipleChoice>]
89
92
  # @return [Class<Scene::MultipleChoice>]
90
93
  def multiple_choice(name = nil, &block)
91
- block Class.new(Scene::MultipleChoice, &block), name
94
+ self.block Class.new(Scene::MultipleChoice, &block), name
92
95
  end
93
96
 
94
97
  # Create a yes-or-no scene.
@@ -113,7 +116,7 @@ module Gamefic
113
116
  # @param name [Symbol, nil]
114
117
  # @return [Class<Scene::YesOrNo>]
115
118
  def yes_or_no(name = nil, &block)
116
- block Class.new(Scene::YesOrNo, &block), name
119
+ self.block Class.new(Scene::YesOrNo, &block), name
117
120
  end
118
121
 
119
122
  # Create an active choice scene.
@@ -121,7 +124,7 @@ module Gamefic
121
124
  # @param name [Symbol, nil]
122
125
  # @return [Class<Scene::ActiveChoice>]
123
126
  def active_choice(name = nil, &block)
124
- block Class.new(Scene::ActiveChoice, &block), name
127
+ self.block Class.new(Scene::ActiveChoice, &block), name
125
128
  end
126
129
 
127
130
  # Create a pause.
@@ -131,9 +134,10 @@ module Gamefic
131
134
  # @param name [Symbol, nil]
132
135
  # @yieldparam [Actor]
133
136
  # @yieldparam [Props::Default]
137
+ # @yieldreceiver [Object<self>]
134
138
  # @return [Class<Scene::Pause>]
135
139
  def pause(name = nil, &block)
136
- block(Class.new(Scene::Pause) do
140
+ self.block(Class.new(Scene::Pause) do
137
141
  on_start(&block)
138
142
  end, name)
139
143
  end
@@ -150,9 +154,10 @@ module Gamefic
150
154
  # @param name [Symbol, nil]
151
155
  # @yieldparam [Actor]
152
156
  # @yieldparam [Props::Default]
157
+ # @yieldreceiver [Object<self>]
153
158
  # @return [Class<Scene::Conclusion>]
154
159
  def conclusion(name = nil, &block)
155
- block(Class.new(Scene::Conclusion) do
160
+ self.block(Class.new(Scene::Conclusion) do
156
161
  on_start(&block)
157
162
  end, name)
158
163
  end
@@ -62,7 +62,7 @@ module Gamefic
62
62
  # pick('the red box')
63
63
  #
64
64
  # @param args [Array]
65
- # @return [Proxy]
65
+ # @return [Proxy::Pick]
66
66
  def pick *args
67
67
  Proxy::Pick.new(*args)
68
68
  end
@@ -18,7 +18,7 @@ module Gamefic
18
18
  # @param translation [String] The format of the translated command
19
19
  # @return [Syntax] the Syntax object
20
20
  def interpret command, translation
21
- syntaxes.push Syntax.new(command, translation)
21
+ syntaxes.push(Syntax.new(command, translation)).last
22
22
  end
23
23
 
24
24
  def syntaxes
@@ -3,7 +3,7 @@ module Gamefic
3
3
  module Seeds
4
4
  # @return [Array<Proc>]
5
5
  def seeds
6
- self.class.seeds
6
+ (included_scripts.flat_map(&:seeds) + self.class.seeds).uniq
7
7
  end
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Gamefic
4
- VERSION = '4.1.1'
4
+ VERSION = '4.1.2'
5
5
  end
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamefic
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.1
4
+ version: 4.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-02 00:00:00.000000000 Z
11
+ date: 2025-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: base64
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: yard-solargraph
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -241,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
241
255
  - !ruby/object:Gem::Version
242
256
  version: '0'
243
257
  requirements: []
244
- rubygems_version: 3.3.7
258
+ rubygems_version: 3.5.22
245
259
  signing_key:
246
260
  specification_version: 4
247
261
  summary: Gamefic