roast-ai 0.4.4 → 0.4.6
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 +4 -4
- data/.github/CODEOWNERS +2 -0
- data/.github/workflows/ci.yaml +1 -0
- data/.gitignore +0 -26
- data/.rubocop.yml +13 -0
- data/.rubocop_todo.yml +21 -0
- data/CHANGELOG.md +37 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +43 -1
- data/bin/rubocop +27 -0
- data/bin/spoom +27 -0
- data/bin/srb +27 -0
- data/bin/srb-rbi +27 -0
- data/bin/tapioca +27 -0
- data/docs/INSTRUMENTATION.md +3 -3
- data/dsl/simple.rb +10 -0
- data/examples/retry/workflow.yml +23 -0
- data/lib/roast/dsl/executor.rb +26 -0
- data/lib/roast/dsl.rb +7 -0
- data/lib/roast/errors.rb +1 -0
- data/lib/roast/factories/api_provider_factory.rb +1 -0
- data/lib/roast/helpers/function_caching_interceptor.rb +3 -0
- data/lib/roast/helpers/logger.rb +6 -9
- data/lib/roast/helpers/metadata_access.rb +1 -0
- data/lib/roast/helpers/minitest_coverage_runner.rb +1 -0
- data/lib/roast/helpers/path_resolver.rb +8 -18
- data/lib/roast/helpers/prompt_loader.rb +3 -2
- data/lib/roast/helpers/timeout_handler.rb +3 -5
- data/lib/roast/initializers.rb +1 -0
- data/lib/roast/resources/api_resource.rb +4 -3
- data/lib/roast/resources/base_resource.rb +1 -0
- data/lib/roast/resources/directory_resource.rb +1 -0
- data/lib/roast/resources/file_resource.rb +1 -0
- data/lib/roast/resources/none_resource.rb +1 -0
- data/lib/roast/resources/url_resource.rb +2 -1
- data/lib/roast/resources.rb +1 -2
- data/lib/roast/services/context_threshold_checker.rb +1 -0
- data/lib/roast/services/token_counting_service.rb +1 -0
- data/lib/roast/tools/apply_diff.rb +1 -0
- data/lib/roast/tools/ask_user.rb +1 -0
- data/lib/roast/tools/bash.rb +1 -0
- data/lib/roast/tools/cmd.rb +1 -0
- data/lib/roast/tools/coding_agent.rb +1 -0
- data/lib/roast/tools/context_summarizer.rb +1 -0
- data/lib/roast/tools/grep.rb +1 -0
- data/lib/roast/tools/helpers/coding_agent_message_formatter.rb +1 -0
- data/lib/roast/tools/read_file.rb +1 -0
- data/lib/roast/tools/search_file.rb +1 -0
- data/lib/roast/tools/swarm.rb +1 -0
- data/lib/roast/tools/update_files.rb +1 -0
- data/lib/roast/tools/write_file.rb +1 -0
- data/lib/roast/tools.rb +2 -0
- data/lib/roast/value_objects/api_token.rb +1 -0
- data/lib/roast/value_objects/step_name.rb +1 -0
- data/lib/roast/value_objects/uri_base.rb +1 -0
- data/lib/roast/value_objects/workflow_path.rb +1 -0
- data/lib/roast/value_objects.rb +1 -0
- data/lib/roast/version.rb +2 -1
- data/lib/roast/workflow/agent_step.rb +1 -0
- data/lib/roast/workflow/api_configuration.rb +1 -0
- data/lib/roast/workflow/base_iteration_step.rb +1 -0
- data/lib/roast/workflow/base_step.rb +1 -0
- data/lib/roast/workflow/base_workflow.rb +1 -0
- data/lib/roast/workflow/case_executor.rb +1 -0
- data/lib/roast/workflow/case_step.rb +1 -0
- data/lib/roast/workflow/command_executor.rb +1 -0
- data/lib/roast/workflow/conditional_executor.rb +1 -0
- data/lib/roast/workflow/conditional_step.rb +1 -0
- data/lib/roast/workflow/configuration.rb +9 -0
- data/lib/roast/workflow/configuration_loader.rb +4 -1
- data/lib/roast/workflow/context_manager.rb +1 -0
- data/lib/roast/workflow/context_path_resolver.rb +1 -0
- data/lib/roast/workflow/dot_access_hash.rb +1 -0
- data/lib/roast/workflow/each_step.rb +1 -0
- data/lib/roast/workflow/error_handler.rb +39 -3
- data/lib/roast/workflow/expression_evaluator.rb +1 -0
- data/lib/roast/workflow/expression_utils.rb +1 -0
- data/lib/roast/workflow/file_state_repository.rb +2 -1
- data/lib/roast/workflow/input_executor.rb +1 -0
- data/lib/roast/workflow/input_step.rb +1 -0
- data/lib/roast/workflow/interpolator.rb +2 -1
- data/lib/roast/workflow/iteration_executor.rb +1 -0
- data/lib/roast/workflow/llm_boolean_coercer.rb +1 -0
- data/lib/roast/workflow/metadata_manager.rb +1 -0
- data/lib/roast/workflow/output_handler.rb +1 -0
- data/lib/roast/workflow/output_manager.rb +1 -0
- data/lib/roast/workflow/parallel_executor.rb +1 -0
- data/lib/roast/workflow/prompt_step.rb +1 -0
- data/lib/roast/workflow/repeat_step.rb +1 -0
- data/lib/roast/workflow/replay_handler.rb +1 -0
- data/lib/roast/workflow/resource_resolver.rb +2 -6
- data/lib/roast/workflow/session_manager.rb +1 -0
- data/lib/roast/workflow/shell_script_step.rb +1 -0
- data/lib/roast/workflow/sqlite_state_repository.rb +1 -0
- data/lib/roast/workflow/state_manager.rb +1 -0
- data/lib/roast/workflow/state_repository.rb +1 -0
- data/lib/roast/workflow/state_repository_factory.rb +4 -2
- data/lib/roast/workflow/step_completion_reporter.rb +1 -0
- data/lib/roast/workflow/step_executor_coordinator.rb +17 -6
- data/lib/roast/workflow/step_executor_factory.rb +1 -0
- data/lib/roast/workflow/step_executor_registry.rb +2 -3
- data/lib/roast/workflow/step_executor_with_reporting.rb +1 -0
- data/lib/roast/workflow/step_executors/base_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/hash_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/parallel_step_executor.rb +1 -0
- data/lib/roast/workflow/step_executors/string_step_executor.rb +1 -0
- data/lib/roast/workflow/step_factory.rb +1 -0
- data/lib/roast/workflow/step_finder.rb +1 -0
- data/lib/roast/workflow/step_loader.rb +1 -0
- data/lib/roast/workflow/step_name_extractor.rb +1 -0
- data/lib/roast/workflow/step_runner.rb +1 -0
- data/lib/roast/workflow/step_type_resolver.rb +1 -0
- data/lib/roast/workflow/validation_command.rb +1 -0
- data/lib/roast/workflow/validator.rb +1 -0
- data/lib/roast/workflow/validators/base_validator.rb +1 -0
- data/lib/roast/workflow/validators/dependency_validator.rb +1 -0
- data/lib/roast/workflow/validators/linting_validator.rb +1 -0
- data/lib/roast/workflow/validators/schema_validator.rb +1 -0
- data/lib/roast/workflow/validators/step_collector.rb +1 -0
- data/lib/roast/workflow/validators/validation_orchestrator.rb +1 -0
- data/lib/roast/workflow/workflow_context.rb +1 -0
- data/lib/roast/workflow/workflow_execution_context.rb +1 -0
- data/lib/roast/workflow/workflow_executor.rb +2 -1
- data/lib/roast/workflow/workflow_initializer.rb +16 -1
- data/lib/roast/workflow/workflow_runner.rb +66 -55
- data/lib/roast/workflow.rb +1 -0
- data/lib/roast/workflow_diagram_generator.rb +3 -2
- data/lib/roast.rb +23 -8
- data/sorbet/config +8 -0
- data/sorbet/rbi/dsl/.gitattributes +1 -0
- data/sorbet/rbi/dsl/active_support/callbacks.rbi +21 -0
- data/sorbet/rbi/gems/.gitattributes +1 -0
- data/sorbet/rbi/gems/activesupport@8.0.2.rbi +19107 -0
- data/sorbet/rbi/gems/addressable@2.8.7.rbi +1994 -0
- data/sorbet/rbi/gems/ast@2.4.3.rbi +585 -0
- data/sorbet/rbi/gems/base64@0.3.0.rbi +545 -0
- data/sorbet/rbi/gems/benchmark@0.4.1.rbi +619 -0
- data/sorbet/rbi/gems/bigdecimal@3.2.2.rbi +62 -0
- data/sorbet/rbi/gems/cgi@0.5.0.rbi +2961 -0
- data/sorbet/rbi/gems/claude_swarm@0.1.19.rbi +568 -0
- data/sorbet/rbi/gems/cli-kit@5.0.1.rbi +1991 -0
- data/sorbet/rbi/gems/cli-ui@2.3.0.rbi +3181 -0
- data/sorbet/rbi/gems/coderay@1.1.3.rbi +9 -0
- data/sorbet/rbi/gems/concurrent-ruby@1.3.5.rbi +11657 -0
- data/sorbet/rbi/gems/connection_pool@2.5.3.rbi +9 -0
- data/sorbet/rbi/gems/crack@1.0.0.rbi +145 -0
- data/sorbet/rbi/gems/diff-lcs@1.6.2.rbi +972 -0
- data/sorbet/rbi/gems/dotenv@3.1.8.rbi +295 -0
- data/sorbet/rbi/gems/drb@2.2.3.rbi +1661 -0
- data/sorbet/rbi/gems/dry-configurable@1.3.0.rbi +672 -0
- data/sorbet/rbi/gems/dry-core@1.1.0.rbi +1894 -0
- data/sorbet/rbi/gems/dry-inflector@1.2.0.rbi +659 -0
- data/sorbet/rbi/gems/dry-initializer@3.2.0.rbi +781 -0
- data/sorbet/rbi/gems/dry-logic@1.6.0.rbi +1127 -0
- data/sorbet/rbi/gems/dry-schema@1.14.1.rbi +3727 -0
- data/sorbet/rbi/gems/dry-types@1.8.3.rbi +3969 -0
- data/sorbet/rbi/gems/erubi@1.13.1.rbi +155 -0
- data/sorbet/rbi/gems/event_stream_parser@1.0.0.rbi +49 -0
- data/sorbet/rbi/gems/faraday-multipart@1.1.1.rbi +283 -0
- data/sorbet/rbi/gems/faraday-net_http@3.4.1.rbi +147 -0
- data/sorbet/rbi/gems/faraday-retry@2.3.2.rbi +9 -0
- data/sorbet/rbi/gems/faraday@2.13.1.rbi +2977 -0
- data/sorbet/rbi/gems/fast-mcp-annotations@1.5.3.rbi +1588 -0
- data/sorbet/rbi/gems/ffi@1.17.2.rbi +9 -0
- data/sorbet/rbi/gems/formatador@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/guard-compat@1.2.1.rbi +102 -0
- data/sorbet/rbi/gems/guard-minitest@2.4.6.rbi +402 -0
- data/sorbet/rbi/gems/guard@2.19.1.rbi +2283 -0
- data/sorbet/rbi/gems/hashdiff@1.2.0.rbi +355 -0
- data/sorbet/rbi/gems/i18n@1.14.7.rbi +2359 -0
- data/sorbet/rbi/gems/json-schema@5.1.1.rbi +1466 -0
- data/sorbet/rbi/gems/json@2.12.2.rbi +2051 -0
- data/sorbet/rbi/gems/language_server-protocol@3.17.0.5.rbi +9 -0
- data/sorbet/rbi/gems/lint_roller@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/listen@3.9.0.rbi +1206 -0
- data/sorbet/rbi/gems/logger@1.7.0.rbi +963 -0
- data/sorbet/rbi/gems/lumberjack@1.2.10.rbi +1830 -0
- data/sorbet/rbi/gems/method_source@1.1.0.rbi +9 -0
- data/sorbet/rbi/gems/mime-types-data@3.2025.0617.rbi +136 -0
- data/sorbet/rbi/gems/mime-types@3.7.0.rbi +1342 -0
- data/sorbet/rbi/gems/minitest-rg@5.3.0.rbi +160 -0
- data/sorbet/rbi/gems/minitest@5.25.5.rbi +1640 -0
- data/sorbet/rbi/gems/mocha@2.7.1.rbi +12 -0
- data/sorbet/rbi/gems/multipart-post@2.4.1.rbi +244 -0
- data/sorbet/rbi/gems/nenv@0.3.0.rbi +147 -0
- data/sorbet/rbi/gems/net-http@0.6.0.rbi +4247 -0
- data/sorbet/rbi/gems/netrc@0.11.0.rbi +159 -0
- data/sorbet/rbi/gems/notiffany@0.1.3.rbi +1079 -0
- data/sorbet/rbi/gems/open_router@0.3.3.rbi +230 -0
- data/sorbet/rbi/gems/ostruct@0.6.2.rbi +354 -0
- data/sorbet/rbi/gems/parallel@1.27.0.rbi +291 -0
- data/sorbet/rbi/gems/parser@3.3.8.0.rbi +5535 -0
- data/sorbet/rbi/gems/prism@1.4.0.rbi +41732 -0
- data/sorbet/rbi/gems/pry@0.15.2.rbi +9 -0
- data/sorbet/rbi/gems/public_suffix@6.0.2.rbi +936 -0
- data/sorbet/rbi/gems/racc@1.8.1.rbi +158 -0
- data/sorbet/rbi/gems/rack@2.2.17.rbi +5659 -0
- data/sorbet/rbi/gems/rainbow@3.1.1.rbi +9 -0
- data/sorbet/rbi/gems/raix@1.0.2.rbi +1104 -0
- data/sorbet/rbi/gems/rake@13.3.0.rbi +3036 -0
- data/sorbet/rbi/gems/rb-fsevent@0.11.2.rbi +9 -0
- data/sorbet/rbi/gems/rb-inotify@0.11.1.rbi +9 -0
- data/sorbet/rbi/gems/rbi@0.3.6.rbi +6893 -0
- data/sorbet/rbi/gems/rbs@3.9.4.rbi +6978 -0
- data/sorbet/rbi/gems/regexp_parser@2.10.0.rbi +9 -0
- data/sorbet/rbi/gems/rexml@3.4.1.rbi +5346 -0
- data/sorbet/rbi/gems/rubocop-ast@1.45.1.rbi +9 -0
- data/sorbet/rbi/gems/rubocop-shopify@2.17.1.rbi +9 -0
- data/sorbet/rbi/gems/rubocop@1.77.0.rbi +9 -0
- data/sorbet/rbi/gems/ruby-graphviz@1.2.5.rbi +1333 -0
- data/sorbet/rbi/gems/ruby-openai@8.1.0.rbi +758 -0
- data/sorbet/rbi/gems/ruby-progressbar@1.13.0.rbi +9 -0
- data/sorbet/rbi/gems/ruby2_keywords@0.0.5.rbi +9 -0
- data/sorbet/rbi/gems/securerandom@0.4.1.rbi +75 -0
- data/sorbet/rbi/gems/shellany@0.0.1.rbi +102 -0
- data/sorbet/rbi/gems/spoom@1.6.3.rbi +6985 -0
- data/sorbet/rbi/gems/sqlite3@2.7.0.rbi +1900 -0
- data/sorbet/rbi/gems/tapioca@0.16.11.rbi +3628 -0
- data/sorbet/rbi/gems/thor@1.4.0.rbi +4399 -0
- data/sorbet/rbi/gems/tzinfo@2.0.6.rbi +5918 -0
- data/sorbet/rbi/gems/unicode-display_width@3.1.4.rbi +9 -0
- data/sorbet/rbi/gems/unicode-emoji@4.0.4.rbi +9 -0
- data/sorbet/rbi/gems/uri@1.0.3.rbi +2349 -0
- data/sorbet/rbi/gems/vcr@6.3.1.rbi +3040 -0
- data/sorbet/rbi/gems/webmock@3.25.1.rbi +1792 -0
- data/sorbet/rbi/gems/yard-sorbet@0.9.0.rbi +435 -0
- data/sorbet/rbi/gems/yard@0.9.37.rbi +18492 -0
- data/sorbet/rbi/gems/zeitwerk@2.7.3.rbi +1429 -0
- data/sorbet/tapioca/config.yml +13 -0
- data/sorbet/tapioca/require.rb +36 -0
- metadata +114 -2
- data/lib/roast/workflow/configuration_parser.rb +0 -54
@@ -0,0 +1,659 @@
|
|
1
|
+
# typed: true
|
2
|
+
|
3
|
+
# DO NOT EDIT MANUALLY
|
4
|
+
# This is an autogenerated file for types exported from the `dry-inflector` gem.
|
5
|
+
# Please instead update this file by running `bin/tapioca gem dry-inflector`.
|
6
|
+
|
7
|
+
|
8
|
+
# source://dry-inflector//lib/dry/inflector.rb#3
|
9
|
+
module Dry
|
10
|
+
class << self
|
11
|
+
# source://dry-configurable/1.3.0/lib/dry/configurable.rb#11
|
12
|
+
def Configurable(**options); end
|
13
|
+
|
14
|
+
# source://dry-core/1.1.0/lib/dry/core.rb#52
|
15
|
+
def Equalizer(*keys, **options); end
|
16
|
+
|
17
|
+
# source://dry-types/1.8.3/lib/dry/types.rb#253
|
18
|
+
def Types(*namespaces, default: T.unsafe(nil), **aliases); end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
# dry-inflector
|
23
|
+
#
|
24
|
+
# @since 0.1.0
|
25
|
+
#
|
26
|
+
# source://dry-inflector//lib/dry/inflector.rb#7
|
27
|
+
class Dry::Inflector
|
28
|
+
# Instantiate the inflector
|
29
|
+
#
|
30
|
+
# @example Basic usage
|
31
|
+
# require "dry/inflector"
|
32
|
+
#
|
33
|
+
# inflector = Dry::Inflector.new
|
34
|
+
# @example Custom inflection rules
|
35
|
+
# require "dry/inflector"
|
36
|
+
#
|
37
|
+
# inflector = Dry::Inflector.new do |inflections|
|
38
|
+
# inflections.plural "virus", "viruses" # specify a rule for #pluralize
|
39
|
+
# inflections.singular "thieves", "thief" # specify a rule for #singularize
|
40
|
+
# inflections.uncountable "dry-inflector" # add an exception for an uncountable word
|
41
|
+
# end
|
42
|
+
# @param blk [Proc] an optional block to specify custom inflection rules
|
43
|
+
# @return [Dry::Inflector] the inflector
|
44
|
+
# @since 0.1.0
|
45
|
+
# @yieldparam the [Dry::Inflector::Inflections] inflection rules
|
46
|
+
#
|
47
|
+
# source://dry-inflector//lib/dry/inflector.rb#33
|
48
|
+
def initialize(&_arg0); end
|
49
|
+
|
50
|
+
# Upper camelize a string
|
51
|
+
#
|
52
|
+
# @example
|
53
|
+
# require "dry/inflector"
|
54
|
+
#
|
55
|
+
# inflector = Dry::Inflector.new
|
56
|
+
# inflector.camelize_upper("data_mapper") # => "DataMapper"
|
57
|
+
# inflector.camelize_upper("dry/inflector") # => "Dry::Inflector"
|
58
|
+
# @param input [String, Symbol] the input
|
59
|
+
# @return [String] the upper camelized string
|
60
|
+
# @since 0.1.3
|
61
|
+
#
|
62
|
+
# source://dry-inflector//lib/dry/inflector.rb#66
|
63
|
+
def camelize(input); end
|
64
|
+
|
65
|
+
# Lower camelize a string
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
# require "dry/inflector"
|
69
|
+
#
|
70
|
+
# inflector = Dry::Inflector.new
|
71
|
+
# inflector.camelize_lower("data_mapper") # => "dataMapper"
|
72
|
+
# @param input [String, Symbol] the input
|
73
|
+
# @return [String] the lower camelized string
|
74
|
+
# @since 0.1.3
|
75
|
+
#
|
76
|
+
# source://dry-inflector//lib/dry/inflector.rb#49
|
77
|
+
def camelize_lower(input); end
|
78
|
+
|
79
|
+
# Upper camelize a string
|
80
|
+
#
|
81
|
+
# @example
|
82
|
+
# require "dry/inflector"
|
83
|
+
#
|
84
|
+
# inflector = Dry::Inflector.new
|
85
|
+
# inflector.camelize_upper("data_mapper") # => "DataMapper"
|
86
|
+
# inflector.camelize_upper("dry/inflector") # => "Dry::Inflector"
|
87
|
+
# @param input [String, Symbol] the input
|
88
|
+
# @return [String] the upper camelized string
|
89
|
+
# @since 0.1.3
|
90
|
+
#
|
91
|
+
# source://dry-inflector//lib/dry/inflector.rb#66
|
92
|
+
def camelize_upper(input); end
|
93
|
+
|
94
|
+
# Classify a string
|
95
|
+
#
|
96
|
+
# @example
|
97
|
+
# require "dry/inflector"
|
98
|
+
#
|
99
|
+
# inflector = Dry::Inflector.new
|
100
|
+
# inflector.classify("books") # => "Book"
|
101
|
+
# @param input [String, Symbol] the input
|
102
|
+
# @return [String] the classified string
|
103
|
+
# @since 0.1.0
|
104
|
+
#
|
105
|
+
# source://dry-inflector//lib/dry/inflector.rb#104
|
106
|
+
def classify(input); end
|
107
|
+
|
108
|
+
# Find a constant with the name specified in the argument string
|
109
|
+
#
|
110
|
+
# The name is assumed to be the one of a top-level constant,
|
111
|
+
# constant scope of caller is ignored
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
# require "dry/inflector"
|
115
|
+
#
|
116
|
+
# inflector = Dry::Inflector.new
|
117
|
+
# inflector.constantize("Module") # => Module
|
118
|
+
# inflector.constantize("Dry::Inflector") # => Dry::Inflector
|
119
|
+
# @param input [String, Symbol] the input
|
120
|
+
# @return [Class, Module] the class or module
|
121
|
+
# @since 0.1.0
|
122
|
+
#
|
123
|
+
# source://dry-inflector//lib/dry/inflector.rb#88
|
124
|
+
def constantize(input); end
|
125
|
+
|
126
|
+
# Dasherize a string
|
127
|
+
#
|
128
|
+
# @example
|
129
|
+
# require "dry/inflector"
|
130
|
+
#
|
131
|
+
# inflector = Dry::Inflector.new
|
132
|
+
# inflector.dasherize("dry_inflector") # => "dry-inflector"
|
133
|
+
# @param input [String, Symbol] the input
|
134
|
+
# @return [String] the dasherized string
|
135
|
+
# @since 0.1.0
|
136
|
+
#
|
137
|
+
# source://dry-inflector//lib/dry/inflector.rb#120
|
138
|
+
def dasherize(input); end
|
139
|
+
|
140
|
+
# Demodulize a string
|
141
|
+
#
|
142
|
+
# @example
|
143
|
+
# require "dry/inflector"
|
144
|
+
#
|
145
|
+
# inflector = Dry::Inflector.new
|
146
|
+
# inflector.demodulize("Dry::Inflector") # => "Inflector"
|
147
|
+
# @param input [String, Symbol] the input
|
148
|
+
# @return [String] the demodulized string
|
149
|
+
# @since 0.1.0
|
150
|
+
#
|
151
|
+
# source://dry-inflector//lib/dry/inflector.rb#136
|
152
|
+
def demodulize(input); end
|
153
|
+
|
154
|
+
# Creates a foreign key name
|
155
|
+
#
|
156
|
+
# @example
|
157
|
+
# require "dry/inflector"
|
158
|
+
#
|
159
|
+
# inflector = Dry::Inflector.new
|
160
|
+
# inflector.foreign_key("Message") => "message_id"
|
161
|
+
# @param input [String, Symbol] the input
|
162
|
+
# @return [String] foreign key
|
163
|
+
# @since 0.1.0
|
164
|
+
#
|
165
|
+
# source://dry-inflector//lib/dry/inflector.rb#175
|
166
|
+
def foreign_key(input); end
|
167
|
+
|
168
|
+
# Humanize a string
|
169
|
+
#
|
170
|
+
# @example
|
171
|
+
# require "dry/inflector"
|
172
|
+
#
|
173
|
+
# inflector = Dry::Inflector.new
|
174
|
+
# inflector.humanize("dry_inflector") # => "Dry inflector"
|
175
|
+
# inflector.humanize("author_id") # => "Author"
|
176
|
+
# @param input [String, Symbol] the input
|
177
|
+
# @return [String] the humanized string
|
178
|
+
# @since 0.1.0
|
179
|
+
#
|
180
|
+
# source://dry-inflector//lib/dry/inflector.rb#153
|
181
|
+
def humanize(input); end
|
182
|
+
|
183
|
+
# @api public
|
184
|
+
# @return [String]
|
185
|
+
# @since 0.2.0
|
186
|
+
#
|
187
|
+
# source://dry-inflector//lib/dry/inflector.rb#310
|
188
|
+
def inspect; end
|
189
|
+
|
190
|
+
# Ordinalize a number
|
191
|
+
#
|
192
|
+
# @example
|
193
|
+
# require "dry/inflector"
|
194
|
+
#
|
195
|
+
# inflector = Dry::Inflector.new
|
196
|
+
# inflector.ordinalize(1) # => "1st"
|
197
|
+
# inflector.ordinalize(2) # => "2nd"
|
198
|
+
# inflector.ordinalize(3) # => "3rd"
|
199
|
+
# inflector.ordinalize(10) # => "10th"
|
200
|
+
# inflector.ordinalize(23) # => "23rd"
|
201
|
+
# @param number [Integer] the input
|
202
|
+
# @return [String] the ordinalized number
|
203
|
+
# @since 0.1.0
|
204
|
+
#
|
205
|
+
# source://dry-inflector//lib/dry/inflector.rb#195
|
206
|
+
def ordinalize(number); end
|
207
|
+
|
208
|
+
# Pluralize a string
|
209
|
+
#
|
210
|
+
# @example
|
211
|
+
# require "dry/inflector"
|
212
|
+
#
|
213
|
+
# inflector = Dry::Inflector.new
|
214
|
+
# inflector.pluralize("book") # => "books"
|
215
|
+
# inflector.pluralize("money") # => "money"
|
216
|
+
# @param input [String, Symbol] the input
|
217
|
+
# @return [String] the pluralized string
|
218
|
+
# @since 0.1.0
|
219
|
+
#
|
220
|
+
# source://dry-inflector//lib/dry/inflector.rb#223
|
221
|
+
def pluralize(input); end
|
222
|
+
|
223
|
+
# Singularize a string
|
224
|
+
#
|
225
|
+
# @example
|
226
|
+
# require "dry/inflector"
|
227
|
+
#
|
228
|
+
# inflector = Dry::Inflector.new
|
229
|
+
# inflector.singularize("books") # => "book"
|
230
|
+
# inflector.singularize("money") # => "money"
|
231
|
+
# @param input [String] the input
|
232
|
+
# @return [String] the singularized string
|
233
|
+
# @since 0.1.0
|
234
|
+
#
|
235
|
+
# source://dry-inflector//lib/dry/inflector.rb#243
|
236
|
+
def singularize(input); end
|
237
|
+
|
238
|
+
# Tableize a string
|
239
|
+
#
|
240
|
+
# @example
|
241
|
+
# require "dry/inflector"
|
242
|
+
#
|
243
|
+
# inflector = Dry::Inflector.new
|
244
|
+
# inflector.tableize("Book") # => "books"
|
245
|
+
# @param input [String, Symbol] the input
|
246
|
+
# @return [String] the tableized string
|
247
|
+
# @since 0.1.0
|
248
|
+
#
|
249
|
+
# source://dry-inflector//lib/dry/inflector.rb#262
|
250
|
+
def tableize(input); end
|
251
|
+
|
252
|
+
# @api public
|
253
|
+
# @return [String]
|
254
|
+
# @since 0.2.0
|
255
|
+
#
|
256
|
+
# source://dry-inflector//lib/dry/inflector.rb#310
|
257
|
+
def to_s; end
|
258
|
+
|
259
|
+
# Check if the input is an uncountable word
|
260
|
+
#
|
261
|
+
# @api private
|
262
|
+
# @param input [String] the input
|
263
|
+
# @return [TrueClass, FalseClass] the result of the check
|
264
|
+
# @since 0.1.0
|
265
|
+
#
|
266
|
+
# source://dry-inflector//lib/dry/inflector.rb#300
|
267
|
+
def uncountable?(input); end
|
268
|
+
|
269
|
+
# Underscore a string
|
270
|
+
#
|
271
|
+
# @example
|
272
|
+
# require "dry/inflector"
|
273
|
+
#
|
274
|
+
# inflector = Dry::Inflector.new
|
275
|
+
# inflector.underscore("dry-inflector") # => "dry_inflector"
|
276
|
+
# @param input [String, Symbol] the input
|
277
|
+
# @return [String] the underscored string
|
278
|
+
# @since 0.1.0
|
279
|
+
#
|
280
|
+
# source://dry-inflector//lib/dry/inflector.rb#279
|
281
|
+
def underscore(input); end
|
282
|
+
|
283
|
+
private
|
284
|
+
|
285
|
+
# @since 0.1.0
|
286
|
+
#
|
287
|
+
# source://dry-inflector//lib/dry/inflector.rb#325
|
288
|
+
def inflections; end
|
289
|
+
|
290
|
+
# @api private
|
291
|
+
# @since 0.1.3
|
292
|
+
#
|
293
|
+
# source://dry-inflector//lib/dry/inflector.rb#329
|
294
|
+
def internal_camelize(input, upper); end
|
295
|
+
end
|
296
|
+
|
297
|
+
# A set of acronyms
|
298
|
+
#
|
299
|
+
# @api private
|
300
|
+
# @since 0.1.2
|
301
|
+
#
|
302
|
+
# source://dry-inflector//lib/dry/inflector/acronyms.rb#9
|
303
|
+
class Dry::Inflector::Acronyms
|
304
|
+
# @api private
|
305
|
+
# @return [Acronyms] a new instance of Acronyms
|
306
|
+
# @since 0.1.2
|
307
|
+
#
|
308
|
+
# source://dry-inflector//lib/dry/inflector/acronyms.rb#14
|
309
|
+
def initialize; end
|
310
|
+
|
311
|
+
# @api private
|
312
|
+
# @since 0.1.2
|
313
|
+
#
|
314
|
+
# source://dry-inflector//lib/dry/inflector/acronyms.rb#27
|
315
|
+
def add(rule, replacement); end
|
316
|
+
|
317
|
+
# @api private
|
318
|
+
# @since 0.1.2
|
319
|
+
#
|
320
|
+
# source://dry-inflector//lib/dry/inflector/acronyms.rb#21
|
321
|
+
def apply_to(word, capitalize: T.unsafe(nil)); end
|
322
|
+
|
323
|
+
# @api private
|
324
|
+
# @since 0.1.2
|
325
|
+
#
|
326
|
+
# source://dry-inflector//lib/dry/inflector/acronyms.rb#10
|
327
|
+
def regex; end
|
328
|
+
|
329
|
+
private
|
330
|
+
|
331
|
+
# @api private
|
332
|
+
# @since 0.1.2
|
333
|
+
#
|
334
|
+
# source://dry-inflector//lib/dry/inflector/acronyms.rb#36
|
335
|
+
def define_regex_patterns; end
|
336
|
+
end
|
337
|
+
|
338
|
+
# @api private
|
339
|
+
# @since 0.1.2
|
340
|
+
#
|
341
|
+
# source://dry-inflector//lib/dry/inflector.rb#323
|
342
|
+
Dry::Inflector::DEFAULT_SEPARATOR = T.let(T.unsafe(nil), String)
|
343
|
+
|
344
|
+
# Inflections
|
345
|
+
#
|
346
|
+
# @since 0.1.0
|
347
|
+
#
|
348
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#12
|
349
|
+
class Dry::Inflector::Inflections
|
350
|
+
# Instantiate the rules
|
351
|
+
#
|
352
|
+
# @api private
|
353
|
+
# @return [Dry::Inflector::Inflections]
|
354
|
+
# @since 0.1.0
|
355
|
+
# @yieldparam [self]
|
356
|
+
#
|
357
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#76
|
358
|
+
def initialize; end
|
359
|
+
|
360
|
+
# Add one or more acronyms
|
361
|
+
#
|
362
|
+
# Acronyms affect how basic operations are performed, such
|
363
|
+
# as camelize/underscore.
|
364
|
+
#
|
365
|
+
# @example
|
366
|
+
# require "dry/inflector"
|
367
|
+
#
|
368
|
+
# inflector = Dry::Inflector.new do |inflections|
|
369
|
+
# inflections.acronym "HTML"
|
370
|
+
# end
|
371
|
+
#
|
372
|
+
# inflector.camelize("html") # => "HTML"
|
373
|
+
# inflector.underscore("HTMLIsFun") # => "html_is_fun"
|
374
|
+
# @param words [Array<String>] a list of acronyms
|
375
|
+
# @since 0.1.2
|
376
|
+
#
|
377
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#197
|
378
|
+
def acronym(*words); end
|
379
|
+
|
380
|
+
# Acronyms
|
381
|
+
#
|
382
|
+
# @api private
|
383
|
+
# @return [Dry::Inflector::Acronyms]
|
384
|
+
# @since 0.1.2
|
385
|
+
#
|
386
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#67
|
387
|
+
def acronyms; end
|
388
|
+
|
389
|
+
# Add a custom humanize rule
|
390
|
+
#
|
391
|
+
# Specifies a humanized form of a string by a regular expression rule or
|
392
|
+
# by a string mapping.
|
393
|
+
#
|
394
|
+
# When using a regular expression based replacement, the normal humanize
|
395
|
+
# formatting is called after the replacement.
|
396
|
+
#
|
397
|
+
# When a string is used, the human form should be specified as desired
|
398
|
+
# (example: `"The name"`, not `"the_name"`)
|
399
|
+
#
|
400
|
+
# @example
|
401
|
+
# require "dry/inflector"
|
402
|
+
#
|
403
|
+
# inflector = Dry::Inflector.new do |inflections|
|
404
|
+
# inflections.human(/_cnt$/i, '\1_count')
|
405
|
+
# inflections.human("legacy_col_person_name", "Name")
|
406
|
+
# end
|
407
|
+
# @param rule [String, Regexp] the rule
|
408
|
+
# @param replacement [String] the replacement
|
409
|
+
# @since 0.1.0
|
410
|
+
#
|
411
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#224
|
412
|
+
def human(rule, replacement); end
|
413
|
+
|
414
|
+
# Human rules
|
415
|
+
#
|
416
|
+
# @api private
|
417
|
+
# @return [Dry::Inflector::Rules]
|
418
|
+
# @since 0.1.0
|
419
|
+
#
|
420
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#59
|
421
|
+
def humans; end
|
422
|
+
|
423
|
+
# Add a custom pluralization rule
|
424
|
+
#
|
425
|
+
# Specifies a new irregular that applies to both pluralization
|
426
|
+
# and singularization at the same time.
|
427
|
+
#
|
428
|
+
# This can only be used for strings, not regular expressions.
|
429
|
+
# You simply pass the irregular in singular and plural form.
|
430
|
+
#
|
431
|
+
# @example
|
432
|
+
# require "dry/inflector"
|
433
|
+
#
|
434
|
+
# inflector = Dry::Inflector.new do |inflections|
|
435
|
+
# inflections.singular "octopus", "octopi"
|
436
|
+
# end
|
437
|
+
# @param singular [String] the singular
|
438
|
+
# @param plural [String] the plural
|
439
|
+
# @since 0.1.0
|
440
|
+
#
|
441
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#151
|
442
|
+
def irregular(singular, plural); end
|
443
|
+
|
444
|
+
# Add a custom pluralization rule
|
445
|
+
#
|
446
|
+
# Specifies a new pluralization rule and its replacement.
|
447
|
+
# The rule can either be a string or a regular expression.
|
448
|
+
#
|
449
|
+
# The replacement should always be a string that may include
|
450
|
+
# references to the matched data from the rule.
|
451
|
+
#
|
452
|
+
# @example
|
453
|
+
# require "dry/inflector"
|
454
|
+
#
|
455
|
+
# inflector = Dry::Inflector.new do |inflections|
|
456
|
+
# inflections.plural "virus", "viruses"
|
457
|
+
# end
|
458
|
+
# @param rule [String, Regexp] the rule
|
459
|
+
# @param replacement [String] the replacement
|
460
|
+
# @since 0.1.0
|
461
|
+
#
|
462
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#105
|
463
|
+
def plural(rule, replacement); end
|
464
|
+
|
465
|
+
# Pluralization rules
|
466
|
+
#
|
467
|
+
# @api private
|
468
|
+
# @return [Dry::Inflector::Rules]
|
469
|
+
# @since 0.1.0
|
470
|
+
#
|
471
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#35
|
472
|
+
def plurals; end
|
473
|
+
|
474
|
+
# Add a custom singularization rule
|
475
|
+
#
|
476
|
+
# Specifies a new singularization rule and its replacement.
|
477
|
+
# The rule can either be a string or a regular expression.
|
478
|
+
#
|
479
|
+
# The replacement should always be a string that may include
|
480
|
+
# references to the matched data from the rule.
|
481
|
+
#
|
482
|
+
# @example
|
483
|
+
# require "dry/inflector"
|
484
|
+
#
|
485
|
+
# inflector = Dry::Inflector.new do |inflections|
|
486
|
+
# inflections.singular "thieves", "thief"
|
487
|
+
# end
|
488
|
+
# @param rule [String, Regexp] the rule
|
489
|
+
# @param replacement [String] the replacement
|
490
|
+
# @since 0.1.0
|
491
|
+
#
|
492
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#128
|
493
|
+
def singular(rule, replacement); end
|
494
|
+
|
495
|
+
# Singularization rules
|
496
|
+
#
|
497
|
+
# @api private
|
498
|
+
# @return [Dry::Inflector::Rules]
|
499
|
+
# @since 0.1.0
|
500
|
+
#
|
501
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#43
|
502
|
+
def singulars; end
|
503
|
+
|
504
|
+
# Add a custom rule for uncountable words
|
505
|
+
#
|
506
|
+
# Uncountable will not be inflected
|
507
|
+
#
|
508
|
+
# @example
|
509
|
+
# require "dry/inflector"
|
510
|
+
#
|
511
|
+
# inflector = Dry::Inflector.new do |inflections|
|
512
|
+
# inflections.uncountable "money"
|
513
|
+
# inflections.uncountable "money", "information"
|
514
|
+
# inflections.uncountable %w(money information rice)
|
515
|
+
# end
|
516
|
+
# @param words [Enumerable<String>]
|
517
|
+
# @since 0.1.0
|
518
|
+
#
|
519
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#175
|
520
|
+
def uncountable(*words); end
|
521
|
+
|
522
|
+
# Uncountable rules
|
523
|
+
#
|
524
|
+
# @api private
|
525
|
+
# @return [Set]
|
526
|
+
# @since 0.1.0
|
527
|
+
#
|
528
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#51
|
529
|
+
def uncountables; end
|
530
|
+
|
531
|
+
private
|
532
|
+
|
533
|
+
# Add irregular inflection
|
534
|
+
#
|
535
|
+
# @api private
|
536
|
+
# @param rule [String] the rule
|
537
|
+
# @param replacement [String] the replacement
|
538
|
+
# @return [undefined]
|
539
|
+
# @since 0.1.0
|
540
|
+
#
|
541
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#239
|
542
|
+
def add_irregular(rule, replacement, target); end
|
543
|
+
|
544
|
+
# Add a new rule
|
545
|
+
#
|
546
|
+
# @api private
|
547
|
+
# @param rule [String, Regexp] the rule
|
548
|
+
# @param replacement [String, Regexp] the replacement
|
549
|
+
# @param target [Dry::Inflector::Rules] the target
|
550
|
+
# @since 0.1.0
|
551
|
+
#
|
552
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#252
|
553
|
+
def rule(rule, replacement, target); end
|
554
|
+
|
555
|
+
class << self
|
556
|
+
# Instantiate a set of inflection rules.
|
557
|
+
# It adds the default rules and the optional customizations, passed as a block.
|
558
|
+
#
|
559
|
+
# @api private
|
560
|
+
# @param blk [Proc] the optional, custom rules
|
561
|
+
# @since 0.1.0
|
562
|
+
#
|
563
|
+
# source://dry-inflector//lib/dry/inflector/inflections.rb#22
|
564
|
+
def build(&blk); end
|
565
|
+
end
|
566
|
+
end
|
567
|
+
|
568
|
+
# Default inflections
|
569
|
+
#
|
570
|
+
#
|
571
|
+
# @api private
|
572
|
+
# @since 0.1.0
|
573
|
+
#
|
574
|
+
# source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#12
|
575
|
+
module Dry::Inflector::Inflections::Defaults
|
576
|
+
class << self
|
577
|
+
# @api private
|
578
|
+
# @since 0.1.0
|
579
|
+
#
|
580
|
+
# source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#15
|
581
|
+
def call(inflect); end
|
582
|
+
|
583
|
+
private
|
584
|
+
|
585
|
+
# @api private
|
586
|
+
# @since 0.1.2
|
587
|
+
#
|
588
|
+
# source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#112
|
589
|
+
def acronyms(inflect); end
|
590
|
+
|
591
|
+
# @api private
|
592
|
+
# @since 0.1.0
|
593
|
+
#
|
594
|
+
# source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#87
|
595
|
+
def irregular(inflect); end
|
596
|
+
|
597
|
+
# @api private
|
598
|
+
# @since 0.1.0
|
599
|
+
#
|
600
|
+
# source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#25
|
601
|
+
def plural(inflect); end
|
602
|
+
|
603
|
+
# @api private
|
604
|
+
# @since 0.1.0
|
605
|
+
#
|
606
|
+
# source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#55
|
607
|
+
def singular(inflect); end
|
608
|
+
|
609
|
+
# @api private
|
610
|
+
# @since 0.1.0
|
611
|
+
#
|
612
|
+
# source://dry-inflector//lib/dry/inflector/inflections/defaults.rb#105
|
613
|
+
def uncountable(inflect); end
|
614
|
+
end
|
615
|
+
end
|
616
|
+
|
617
|
+
# @api private
|
618
|
+
# @since 0.1.0
|
619
|
+
#
|
620
|
+
# source://dry-inflector//lib/dry/inflector.rb#319
|
621
|
+
Dry::Inflector::ORDINALIZE_TH = T.let(T.unsafe(nil), Hash)
|
622
|
+
|
623
|
+
# A set of inflection rules
|
624
|
+
#
|
625
|
+
# @api private
|
626
|
+
# @since 0.1.0
|
627
|
+
#
|
628
|
+
# source://dry-inflector//lib/dry/inflector/rules.rb#9
|
629
|
+
class Dry::Inflector::Rules
|
630
|
+
# @api private
|
631
|
+
# @return [Rules] a new instance of Rules
|
632
|
+
# @since 0.1.0
|
633
|
+
#
|
634
|
+
# source://dry-inflector//lib/dry/inflector/rules.rb#12
|
635
|
+
def initialize; end
|
636
|
+
|
637
|
+
# @api private
|
638
|
+
# @since 0.1.0
|
639
|
+
#
|
640
|
+
# source://dry-inflector//lib/dry/inflector/rules.rb#18
|
641
|
+
def apply_to(word); end
|
642
|
+
|
643
|
+
# @api private
|
644
|
+
# @since 0.1.0
|
645
|
+
#
|
646
|
+
# source://dry-inflector//lib/dry/inflector/rules.rb#32
|
647
|
+
def each(&_arg0); end
|
648
|
+
|
649
|
+
# @api private
|
650
|
+
# @since 0.1.0
|
651
|
+
#
|
652
|
+
# source://dry-inflector//lib/dry/inflector/rules.rb#26
|
653
|
+
def insert(index, array); end
|
654
|
+
end
|
655
|
+
|
656
|
+
# @since 0.1.0
|
657
|
+
#
|
658
|
+
# source://dry-inflector//lib/dry/inflector/version.rb#6
|
659
|
+
Dry::Inflector::VERSION = T.let(T.unsafe(nil), String)
|