Class: ApiConverter
- Includes:
- InstanceHelpers
- Defined in:
- lib/code_generator/api_converter.rb
Instance Attribute Summary collapse
-
#api_hash ⇒ Object
readonly
Returns the value of attribute api_hash.
Instance Method Summary collapse
- #convert ⇒ Object
-
#initialize(api_json) ⇒ ApiConverter
constructor
A new instance of ApiConverter.
Methods included from InstanceHelpers
#lib_enum_postfix, #lib_prefix
Constructor Details
#initialize(api_json) ⇒ ApiConverter
Returns a new instance of ApiConverter.
12 13 14 |
# File 'lib/code_generator/api_converter.rb', line 12 def initialize(api_json) @api_hash = JSON.parse(api_json) end |
Instance Attribute Details
#api_hash ⇒ Object (readonly)
Returns the value of attribute api_hash.
10 11 12 |
# File 'lib/code_generator/api_converter.rb', line 10 def api_hash @api_hash end |
Instance Method Details
#convert ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/code_generator/api_converter.rb', line 16 def convert ruby_types = ApiRubyTypes.new(version: api_hash['version'], modules: []) (api_hash['modules'] || []).each do |mod| new_mod = convert_module(mod) ruby_types.modules << new_mod ruby_types.all_types.merge!(new_mod.types_hash) end ruby_types end |