Class: Shale::Schema::Compiler::Property Private

Inherits:
Object
  • Object
show all
Defined in:
lib/shale/schema/compiler/property.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Class representing Shale’s property

Direct Known Subclasses

XMLProperty

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, collection, default) ⇒ Property

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Initialize Property object

Parameters:

  • name (String)
  • type (Shale::Schema::Compiler::Type)
  • collection (true, false)
  • default (Object)


41
42
43
44
45
46
47
# File 'lib/shale/schema/compiler/property.rb', line 41

def initialize(name, type, collection, default)
  @mapping_name = name
  @attribute_name = Utils.snake_case(name)
  @type = type
  @collection = collection
  @default = default
end

Instance Attribute Details

#attribute_nameString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return attribute’s name

Returns:



24
25
26
# File 'lib/shale/schema/compiler/property.rb', line 24

def attribute_name
  @attribute_name
end

#mapping_nameString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return mapping’s name

Returns:



17
18
19
# File 'lib/shale/schema/compiler/property.rb', line 17

def mapping_name
  @mapping_name
end

#typeString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return types’s name

Returns:



31
32
33
# File 'lib/shale/schema/compiler/property.rb', line 31

def type
  @type
end

Instance Method Details

#collection?true, false

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return whether property is a collection

Returns:

  • (true, false)


54
55
56
# File 'lib/shale/schema/compiler/property.rb', line 54

def collection?
  @collection
end

#defaultnil, Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return default value

Returns:

  • (nil, Object)


63
64
65
66
# File 'lib/shale/schema/compiler/property.rb', line 63

def default
  return if collection?
  @default.is_a?(::String) ? @default.dump : @default
end