Class: IDL::AST::UnionMember

Inherits:
Member show all
Defined in:
lib/ridl/node.rb,
lib/ridl/node.rb

Overview

Union

Constant Summary collapse

NAMETYPE =
:member

Instance Attribute Summary collapse

Attributes inherited from Member

#idltype

Attributes inherited from Leaf

#annotations, #enclosure, #intern, #lm_name, #name, #prefix, #scopes

Instance Method Summary collapse

Methods inherited from Member

#is_local?

Methods inherited from Leaf

#_set_prefix, #has_annotations?, #is_local?, #is_template?, #lm_name_for_scope, #parsed_name_scope, #replace_prefix, #repo_scopes, #repository_id, #resolve, #scoped_lm_name, #scoped_name, #set_repo_id, #set_repo_version, #typename, #unescaped_name

Constructor Details

#initialize(_name, _enclosure, params) ⇒ UnionMember

Returns a new instance of UnionMember.



2738
2739
2740
2741
2742
2743
2744
2745
2746
# File 'lib/ridl/node.rb', line 2738

def initialize(_name, _enclosure, params)
  super(_name, _enclosure, params)
  ## if any of the labels is 'default' forget about the others
  if params[:labels].include?(:default)
    @labels = [ :default ]
  else
    @labels  = params[:labels]
  end
end

Instance Attribute Details

#labelsObject (readonly)

Returns the value of attribute labels.



2737
2738
2739
# File 'lib/ridl/node.rb', line 2737

def labels
  @labels
end

Instance Method Details

#instantiate(_context, _enclosure) ⇒ Object



2757
2758
2759
2760
2761
2762
# File 'lib/ridl/node.rb', line 2757

def instantiate(_context, _enclosure)
  _params = {
    :labels => @labels.collect { |l| l == :default ? l : l.instantiate(_context) },
  }
  super(_context, _enclosure, _params)
end

#marshal_dumpObject



2748
2749
2750
# File 'lib/ridl/node.rb', line 2748

def marshal_dump
  super() << @labels
end

#marshal_load(vars) ⇒ Object



2752
2753
2754
2755
# File 'lib/ridl/node.rb', line 2752

def marshal_load(vars)
  @labels = vars.pop
  super(vars)
end