Class: Seahorse::Model::ShapeMap Private

Inherits:
Object
  • Object
show all
Defined in:
lib/seahorse/model/shape_map.rb

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.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shape_defs = {}) ⇒ ShapeMap

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.

Returns a new instance of ShapeMap.

Parameters:

  • shape_defs (Hash<String,Hash>) (defaults to: {})

    ({}) A hash of shape definitions. Hash keys should be shape names. Hash values should be shape definitions.



9
10
11
12
# File 'lib/seahorse/model/shape_map.rb', line 9

def initialize(shape_defs = {})
  @definitions = shape_defs
  @shapes = {}
end

Instance Attribute Details

#definitionsHash (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.

Returns:

  • (Hash)


15
16
17
# File 'lib/seahorse/model/shape_map.rb', line 15

def definitions
  @definitions
end

Instance Method Details

#shape(shape_ref) ⇒ Shapes::Shape

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.

Parameters:

  • shape_ref (Hash)

Options Hash (shape_ref):

  • 'shape' (required, String)

Returns:

Raises:

  • (ArgumentError)

    Raised when the given shape ref can not be resolved.



22
23
24
# File 'lib/seahorse/model/shape_map.rb', line 22

def shape(shape_ref)
  @shapes[shape_ref] ||= build_shape(shape_ref)
end

#shape_namesArray<String>

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.

Returns:

  • (Array<String>)


27
28
29
# File 'lib/seahorse/model/shape_map.rb', line 27

def shape_names
  @definitions.keys
end