Class: GoonModelGen::Converter::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/goon_model_gen/converter/mapping.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, args, func, requires_context, returns_error) ⇒ Mapping

Returns a new instance of Mapping.



9
10
11
# File 'lib/goon_model_gen/converter/mapping.rb', line 9

def initialize(name, args, func, requires_context, returns_error)
  @name, @args, @func, @requires_context, @returns_error = name, args, func, requires_context, returns_error
end

Instance Attribute Details

#allow_zeroObject

for int or uint only



8
9
10
# File 'lib/goon_model_gen/converter/mapping.rb', line 8

def allow_zero
  @allow_zero
end

#argsObject (readonly)

Returns the value of attribute args.



6
7
8
# File 'lib/goon_model_gen/converter/mapping.rb', line 6

def args
  @args
end

#funcObject (readonly)

Returns the value of attribute func.



6
7
8
# File 'lib/goon_model_gen/converter/mapping.rb', line 6

def func
  @func
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/goon_model_gen/converter/mapping.rb', line 6

def name
  @name
end

#package_base_pathObject

Returns the value of attribute package_base_path.



7
8
9
# File 'lib/goon_model_gen/converter/mapping.rb', line 7

def package_base_path
  @package_base_path
end

#package_nameObject

Returns the value of attribute package_name.



7
8
9
# File 'lib/goon_model_gen/converter/mapping.rb', line 7

def package_name
  @package_name
end

#requires_contextObject (readonly)

Returns the value of attribute requires_context.



6
7
8
# File 'lib/goon_model_gen/converter/mapping.rb', line 6

def requires_context
  @requires_context
end

#returns_errorObject (readonly)

Returns the value of attribute returns_error.



6
7
8
# File 'lib/goon_model_gen/converter/mapping.rb', line 6

def returns_error
  @returns_error
end

Instance Method Details

#resolve_package_path(config) ⇒ Object



13
14
15
16
17
18
# File 'lib/goon_model_gen/converter/mapping.rb', line 13

def resolve_package_path(config)
  if func.present? && func.include?('.')
    self.package_base_path = requires_context ? config.store_package_path : config.model_package_path
    self.package_name = func.split('.', 2).first
  end
end