Module: RbsGoose

Extended by:
Forwardable
Defined in:
lib/rbs_goose.rb,
lib/rbs_goose/io.rb,
lib/rbs_goose/io/file.rb,
lib/rbs_goose/version.rb,
lib/rbs_goose/orthoses.rb,
lib/rbs_goose/templates.rb,
lib/rbs_goose/io/example.rb,
lib/rbs_goose/configuration.rb,
lib/rbs_goose/io/typed_ruby.rb,
lib/rbs_goose/type_inferrer.rb,
lib/rbs_goose/orthoses/infer.rb,
lib/rbs_goose/templates/base.rb,
lib/rbs_goose/io/target_group.rb,
lib/rbs_goose/io/example_group.rb,
lib/rbs_goose/orthoses/fix_error.rb,
lib/rbs_goose/templates/infer_template.rb,
lib/rbs_goose/templates/fix_error_template.rb

Defined Under Namespace

Modules: IO, Orthoses, Templates Classes: Configuration, Error, TypeInferrer

Constant Summary collapse

VERSION =
'0.2.1'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject (readonly)

Returns the value of attribute configuration.



53
54
55
# File 'lib/rbs_goose.rb', line 53

def configuration
  @configuration
end

Class Method Details

.configureObject



17
18
19
# File 'lib/rbs_goose.rb', line 17

def configure(&)
  @configuration = Configuration.new(&)
end

.fix_error(code_dir: 'lib', sig_dir: 'sig', base_path: ::Dir.pwd) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'lib/rbs_goose.rb', line 35

def fix_error(code_dir: 'lib', sig_dir: 'sig', base_path: ::Dir.pwd)
  puts "Run FixError.(Code Directory: #{code_dir}, Signature Directory: #{sig_dir})"
  target_group = RbsGoose::IO::TargetGroup.load_from(base_path, code_dir:, sig_dir:)
  RbsGoose::TypeInferrer.new.fix_error(target_group).each do |refined_rbs|
    puts "write refined rbs to #{refined_rbs.path}\n"
    refined_rbs.write
    puts "done.\n\n"
  end
end

.fix_error_templateObject



49
50
51
# File 'lib/rbs_goose.rb', line 49

def fix_error_template
  configuration.fix_error_template.build_template
end

.infer_templateObject



45
46
47
# File 'lib/rbs_goose.rb', line 45

def infer_template
  configuration.infer_template.build_template
end

.reset_configurationObject



21
22
23
# File 'lib/rbs_goose.rb', line 21

def reset_configuration
  @configuration = nil
end

.run(code_dir: 'lib', sig_dir: 'sig', base_path: ::Dir.pwd) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/rbs_goose.rb', line 25

def run(code_dir: 'lib', sig_dir: 'sig', base_path: ::Dir.pwd)
  puts "Run RbsGoose.(Code Directory: #{code_dir}, Signature Directory: #{sig_dir})"
  target_group = RbsGoose::IO::TargetGroup.load_from(base_path, code_dir:, sig_dir:)
  RbsGoose::TypeInferrer.new.infer(target_group).each do |refined_rbs|
    puts "write refined rbs to #{refined_rbs.path}\n"
    refined_rbs.write
    puts "done.\n\n"
  end
end