Skip to content

Commit 1e78dcb

Browse files
committed
Impl Config
1 parent 33aeaac commit 1e78dcb

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

_tools/ruby_h_to_go/lib/ruby_h_to_go.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33
require "forwardable"
44
require "ruby_header_parser"
55
require "go_gem/util"
6+
require "yaml"
67

78
require_relative "ruby_h_to_go/type_helper"
89

910
require_relative "ruby_h_to_go/argument_definition"
1011
require_relative "ruby_h_to_go/cli"
12+
require_relative "ruby_h_to_go/config"
1113
require_relative "ruby_h_to_go/go_util"
1214
require_relative "ruby_h_to_go/enum_definition"
1315
require_relative "ruby_h_to_go/function_definition"
@@ -17,4 +19,8 @@
1719

1820
# Generate Go binding from ruby.h
1921
module RubyHToGo
22+
# @return [RubyHToGo::Config]
23+
def self.config
24+
@config ||= RubyHToGo::Config.new
25+
end
2026
end
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# frozen_string_literal: true
2+
3+
module RubyHToGo
4+
class Config
5+
def initialize
6+
@config = YAML.load(File.read(File.expand_path("../../config.yml", __dir__)))
7+
end
8+
9+
# @return [String]
10+
def default_tag
11+
@config["default_tag"]
12+
end
13+
14+
# @return [Array<String>]
15+
def available_tags
16+
@config["available_tags"]
17+
end
18+
end
19+
end

0 commit comments

Comments
 (0)