lib/zenlish/feature/feature_struct_def.rb in zenlish-0.2.05 vs lib/zenlish/feature/feature_struct_def.rb in zenlish-0.2.06
- old
+ new
@@ -1,22 +1,26 @@
+# frozen_string_literal: true
+
require_relative 'feature_domain'
module Zenlish
module Feature
class FeatureStructDef < FeatureDomain
attr_reader :parent
attr_reader :struct
# @param aParent [FeatureStructDef]
def initialize(aParent = nil)
+ super()
@parent = validated_parent(aParent)
@struct = {}
end
# @param aFeatureName [String]
def [](aFeatureName)
return struct[aFeatureName] if struct.include? aFeatureName
+
if parent
p_struct = parent.struct
return p_struct[aFeatureName] if p_struct.include? aFeatureName
end
@@ -39,6 +43,6 @@
nil
end
end
end # class
end # module
-end # module
\ No newline at end of file
+end # module