Class: Seahorse::Model::Shapes::StructureShape
- Inherits:
-
Shape
- Object
- Shape
- Seahorse::Model::Shapes::StructureShape
show all
- Defined in:
- lib/seahorse/model/shapes.rb
Instance Attribute Summary collapse
Attributes inherited from Shape
#documentation, #name, #union
Instance Method Summary
collapse
Methods inherited from Shape
#[], #[]=
Constructor Details
Returns a new instance of StructureShape.
217
218
219
220
221
222
|
# File 'lib/seahorse/model/shapes.rb', line 217
def initialize(options = {})
@members = {}
@members_by_location_name = {}
@required = Set.new
super
end
|
Instance Attribute Details
#required ⇒ Set<Symbol>
225
226
227
|
# File 'lib/seahorse/model/shapes.rb', line 225
def required
@required
end
|
#struct_class ⇒ Class<Struct>
228
229
230
|
# File 'lib/seahorse/model/shapes.rb', line 228
def struct_class
@struct_class
end
|
Instance Method Details
#add_member(name, shape_ref) ⇒ Object
232
233
234
235
236
237
|
# File 'lib/seahorse/model/shapes.rb', line 232
def add_member(name, shape_ref)
name = name.to_sym
@required << name if shape_ref.required
@members_by_location_name[shape_ref.location_name] = [name, shape_ref]
@members[name] = shape_ref
end
|
258
259
260
261
262
263
264
|
# File 'lib/seahorse/model/shapes.rb', line 258
def member(name)
if member?(name)
@members[name.to_sym]
else
raise ArgumentError, "no such member #{name.inspect}"
end
end
|
#member?(member_name) ⇒ Boolean
Returns ‘true` if there exists a member with the given name.
247
248
249
|
# File 'lib/seahorse/model/shapes.rb', line 247
def member?(member_name)
@members.key?(member_name.to_sym)
end
|
#member_by_location_name(location_name) ⇒ 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.
267
268
269
|
# File 'lib/seahorse/model/shapes.rb', line 267
def member_by_location_name(location_name)
@members_by_location_name[location_name]
end
|
#member_names ⇒ Array<Symbol>
240
241
242
|
# File 'lib/seahorse/model/shapes.rb', line 240
def member_names
@members.keys
end
|
#members ⇒ Enumerator<[Symbol,ShapeRef]>
252
253
254
|
# File 'lib/seahorse/model/shapes.rb', line 252
def members
@members.to_enum
end
|