Class: IDL::AST::UnionMember

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

Overview

Union

Instance Attribute Summary collapse

Attributes inherited from Member

#idltype

Attributes inherited from Leaf

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

Instance Method Summary collapse

Methods inherited from Member

#is_local?

Methods inherited from Leaf

#has_annotations?, #is_local?, #is_template?, #lm_name, #lm_scopes, #replace_prefix, #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.



2838
2839
2840
2841
2842
2843
2844
2845
2846
# File 'lib/ridl/node.rb', line 2838

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.



2836
2837
2838
# File 'lib/ridl/node.rb', line 2836

def labels
  @labels
end

Instance Method Details

#instantiate(instantiation_context, _enclosure) ⇒ Object



2857
2858
2859
2860
2861
2862
# File 'lib/ridl/node.rb', line 2857

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

#marshal_dumpObject



2848
2849
2850
# File 'lib/ridl/node.rb', line 2848

def marshal_dump
  super() << @labels
end

#marshal_load(vars) ⇒ Object



2852
2853
2854
2855
# File 'lib/ridl/node.rb', line 2852

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