class GoonModelGen::Source::File
Attributes
path[R]
types[R]
Public Class Methods
new(path)
click to toggle source
@param path [string]
# File lib/goon_model_gen/source/file.rb, line 17 def initialize(path) @path = path @types = [] end
Public Instance Methods
basename()
click to toggle source
# File lib/goon_model_gen/source/file.rb, line 22 def basename ::File.basename(path, '.*') end
new_enum(name, base_type, elements)
click to toggle source
@param name [string] @param base_type [String] @param elements [Hash<Object,Hash>] elements of enum from YAML @return [Enum]
# File lib/goon_model_gen/source/file.rb, line 40 def new_enum(name, base_type, elements) Enum.new(name, base_type, elements).tap do |t| t.context = self.context types.push(t) end end
new_named_slice(name, base_type_name)
click to toggle source
@param name [string] @param base_type_name [string] @return [Slice]
# File lib/goon_model_gen/source/file.rb, line 50 def new_named_slice(name, base_type_name) NamedSlice.new(name, base_type_name).tap do |s| s.context = self.context types.push(s) end end
new_struct(name)
click to toggle source
@param name [string] @return [Struct]
# File lib/goon_model_gen/source/file.rb, line 28 def new_struct(name) Struct.new(name).tap do |s| s.context = self.context s.file = self types.push(s) end end