Class: Rubyang::Database::SchemaTree::Identityref

Inherits:
Type
  • Object
show all
Defined in:
lib/rubyang/database/schema_tree.rb

Instance Attribute Summary

Attributes inherited from Type

#arg

Instance Method Summary collapse

Constructor Details

#initialize(identity_list, type_stmt) ⇒ Identityref

Returns a new instance of Identityref.



215
216
217
218
219
# File 'lib/rubyang/database/schema_tree.rb', line 215

def initialize identity_list, type_stmt
  @arg = 'identityref'
  @base_arg = type_stmt.substmt( 'base' ).first.arg
  @identity_list = identity_list
end

Instance Method Details

#valid?(value) ⇒ Boolean

Returns:

  • (Boolean)


220
221
222
# File 'lib/rubyang/database/schema_tree.rb', line 220

def valid? value
  @identity_list.select{ |identity| (identity.substmt( 'base' ).first.arg rescue nil) == @base_arg }.any?{ |identity| identity.arg == value }
end