Class: RubyHToGo::Cli

Inherits:
Object
  • Object
show all
Defined in:
_tools/ruby_h_to_go/lib/ruby_h_to_go/cli.rb

Overview

client for ruby_h_to_go

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(header_file:, include_paths:, dist_dir:, dist_preprocessed_header_file:) ⇒ Cli

Returns a new instance of Cli.

Parameters:

  • header_file (String)

    path to ruby.h

  • include_paths (Array<String>)
  • dist_dir (String)
  • dist_preprocessed_header_file (String)


26
27
28
29
30
31
# File '_tools/ruby_h_to_go/lib/ruby_h_to_go/cli.rb', line 26

def initialize(header_file:, include_paths:, dist_dir:, dist_preprocessed_header_file:)
  @header_file = header_file
  @include_paths = include_paths
  @dist_dir = dist_dir
  @dist_preprocessed_header_file = dist_preprocessed_header_file
end

Instance Attribute Details

#dist_dirObject (readonly)

Returns the value of attribute dist_dir.



16
17
18
# File '_tools/ruby_h_to_go/lib/ruby_h_to_go/cli.rb', line 16

def dist_dir
  @dist_dir
end

#dist_preprocessed_header_fileObject (readonly)

Returns the value of attribute dist_preprocessed_header_file.



20
21
22
# File '_tools/ruby_h_to_go/lib/ruby_h_to_go/cli.rb', line 20

def dist_preprocessed_header_file
  @dist_preprocessed_header_file
end

#header_fileObject (readonly)

Returns the value of attribute header_file.



8
9
10
# File '_tools/ruby_h_to_go/lib/ruby_h_to_go/cli.rb', line 8

def header_file
  @header_file
end

#include_pathsObject (readonly)

Returns the value of attribute include_paths.



12
13
14
# File '_tools/ruby_h_to_go/lib/ruby_h_to_go/cli.rb', line 12

def include_paths
  @include_paths
end

Instance Method Details

#performObject



33
34
35
36
37
38
39
40
41
42
43
44
# File '_tools/ruby_h_to_go/lib/ruby_h_to_go/cli.rb', line 33

def perform
  clean_generated_files

  write_type_definitions_to_go_file
  write_struct_definitions_to_go_file
  write_function_definitions_to_go_file
  write_enum_definitions_to_go_file

  copy_go_files
  remove_unused_imports
  go_fmt
end