Class: Rubyang::Database::SchemaTree::Leaf

Inherits:
LeafSchemaNode show all
Defined in:
lib/rubyang/database/schema_tree.rb

Instance Attribute Summary

Attributes inherited from LeafSchemaNode

#arg, #current_module, #identity_list, #module, #parent, #typedef_list, #yang, #yangs

Attributes inherited from SchemaNode

#arg, #module, #parent, #yang, #yangs

Instance Method Summary collapse

Methods inherited from LeafSchemaNode

#initialize, #resolve_type, #type

Methods inherited from SchemaNode

#evaluate_xpath, #evaluate_xpath_axis, #evaluate_xpath_expr, #evaluate_xpath_node_test, #evaluate_xpath_path, #evaluate_xpath_predicates, #initialize, #load_yang, #model, #namespace, #prefix, #root, #to_json, #to_s

Constructor Details

This class inherits a constructor from Rubyang::Database::SchemaTree::LeafSchemaNode

Instance Method Details

#to_json_recursive(h) ⇒ Object



1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
# File 'lib/rubyang/database/schema_tree.rb', line 1137

def to_json_recursive h
  h['type'] = 'leaf'
  h['arg'] = @arg
  case @type
  when Rubyang::Database::SchemaTree::StringType
    h['datatype'] = 'string'
    h['parameters'] = Hash.new
    h['parameters']['length'] = @type.length.to_s
    h['parameters']['pattern'] = @type.pattern.to_s
  else
    raise
  end
  h
end