class Seahorse::Model::Shapes::StructureShape

Attributes

required[RW]

@return [Set<Symbol>]

Public Class Methods

new(options = {}) click to toggle source
Calls superclass method Seahorse::Model::Shapes::Shape.new
# File lib/seahorse/model/shapes.rb, line 150
def initialize(options = {})
  @members = {}
  @members_by_location_name = {}
  @required = Set.new
  super()
end

Public Instance Methods

add_member(name, shape_ref) click to toggle source

@param [Symbol] name @param [ShapeRef] shape_ref

# File lib/seahorse/model/shapes.rb, line 162
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
member(name) click to toggle source

@param [Symbol] name @return [ShapeRef]

# File lib/seahorse/model/shapes.rb, line 188
def member(name)
  if member?(name)
    @members[name.to_sym]
  else
    raise ArgumentError, "no such member #{name.inspect}"
  end
end
member?(member_name) click to toggle source

@param [Symbol] member_name @return [Boolean] Returns `true` if there exists a member with

the given name.
# File lib/seahorse/model/shapes.rb, line 177
def member?(member_name)
  @members.key?(member_name.to_sym)
end
member_by_location_name(location_name) click to toggle source

@api private

# File lib/seahorse/model/shapes.rb, line 197
def member_by_location_name(location_name)
  @members_by_location_name[location_name]
end
member_names() click to toggle source

@return [Array<Symbol>]

# File lib/seahorse/model/shapes.rb, line 170
def member_names
  @members.keys
end
members() click to toggle source

@return [Enumerator<>]

# File lib/seahorse/model/shapes.rb, line 182
def members
  @members.to_enum
end