Class: Seahorse::Model::Shapes::Shape
- Inherits:
-
Object
- Object
- Seahorse::Model::Shapes::Shape
show all
- Defined in:
- lib/seahorse/model/shapes.rb
Class Attribute Summary collapse
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(definition, options = {}) ⇒ Shape
Returns a new instance of Shape.
64
65
66
67
68
69
70
71
72
|
# File 'lib/seahorse/model/shapes.rb', line 64
def initialize(definition, options = {})
definition['type'] ||= self.class.type
@name = definition['shape']
@definition = definition
@type = definition['type']
@location = definition['location'] || 'body'
@location_name = definition['locationName']
@shape_map = options[:shape_map] || ShapeMap.new
end
|
Class Attribute Details
145
146
147
|
# File 'lib/seahorse/model/shapes.rb', line 145
def type
@type
end
|
Instance Attribute Details
#definition ⇒ Hash
78
79
80
|
# File 'lib/seahorse/model/shapes.rb', line 78
def definition
@definition
end
|
#documentation ⇒ String?
97
98
99
|
# File 'lib/seahorse/model/shapes.rb', line 97
def documentation
@documentation
end
|
84
85
86
|
# File 'lib/seahorse/model/shapes.rb', line 84
def location
@location
end
|
#location_name ⇒ String?
89
90
91
|
# File 'lib/seahorse/model/shapes.rb', line 89
def location_name
@location_name
end
|
75
76
77
|
# File 'lib/seahorse/model/shapes.rb', line 75
def name
@name
end
|
94
95
96
|
# File 'lib/seahorse/model/shapes.rb', line 94
def shape_map
@shape_map
end
|
81
82
83
|
# File 'lib/seahorse/model/shapes.rb', line 81
def type
@type
end
|
Class Method Details
.new(definition = {}, options = {}) ⇒ Shape
Constructs and returns a new shape object. You must specify the shape type using the “type” option or you must construct the shape using the appropriate subclass of ‘Shape`.
170
171
172
173
174
175
176
|
# File 'lib/seahorse/model/shapes.rb', line 170
def new(definition = {}, options = {})
if self == Shape
from_type(definition, options)
else
super(apply_type(definition), options)
end
end
|
Instance Method Details
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.
109
110
111
|
# File 'lib/seahorse/model/shapes.rb', line 109
def inspect
"#<#{self.class.name}>"
end
|
103
104
105
|
# File 'lib/seahorse/model/shapes.rb', line 103
def metadata(key)
@definition[key.to_s]
end
|
#with(options) ⇒ 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.
114
115
116
|
# File 'lib/seahorse/model/shapes.rb', line 114
def with(options)
self.class.new(@definition.merge(options), shape_map: shape_map)
end
|