Class: RGen::ECore::ECoreToRuby::FeatureWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/rgen/ecore/ecore_to_ruby.rb

Instance Method Summary collapse

Constructor Details

#initialize(efeature, classifiers) ⇒ FeatureWrapper

Returns a new instance of FeatureWrapper.



148
149
150
151
# File 'lib/rgen/ecore/ecore_to_ruby.rb', line 148

def initialize(efeature, classifiers)
  @efeature = efeature
  @classifiers = classifiers
end

Instance Method Details

#impl_typeObject



165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/rgen/ecore/ecore_to_ruby.rb', line 165

def impl_type
  etype = @efeature.eType
  if etype.is_a?(RGen::ECore::EClass) || etype.is_a?(RGen::ECore::EEnum)
    @classifiers[etype]
  else
    ic = etype.instanceClass
    if ic
      ic
    else
      raise "unknown type: #{etype.name}" 
    end
  end
end

#many?Boolean

Returns:

  • (Boolean)


156
157
158
# File 'lib/rgen/ecore/ecore_to_ruby.rb', line 156

def many?
  @efeature.many
end

#oppositeObject



162
163
164
# File 'lib/rgen/ecore/ecore_to_ruby.rb', line 162

def opposite
  @efeature.eOpposite
end

#reference?Boolean

Returns:

  • (Boolean)


159
160
161
# File 'lib/rgen/ecore/ecore_to_ruby.rb', line 159

def reference?
  @efeature.is_a?(RGen::ECore::EReference)
end

#value(prop) ⇒ Object



152
153
154
155
# File 'lib/rgen/ecore/ecore_to_ruby.rb', line 152

def value(prop)
  return false if prop == :containment && @efeature.is_a?(RGen::ECore::EAttribute)
  @efeature.send(prop)
end