Class: Rubyang::Model::StmtMap

Inherits:
Object
  • Object
show all
Defined in:
lib/rubyang/model.rb

Constant Summary collapse

@@stmt_map =
[
  { :name => 'anyxml',           :class => Rubyang::Model::Anyxml },
  { :name => 'augment',          :class => Rubyang::Model::Augment },
  { :name => 'argument',         :class => Rubyang::Model::Argument },
  { :name => 'base',             :class => Rubyang::Model::Base },
  { :name => 'belongs-to',       :class => Rubyang::Model::BelongsTo },
  { :name => 'bit',              :class => Rubyang::Model::Bit },
  { :name => 'case',             :class => Rubyang::Model::Case },
  { :name => 'choice',           :class => Rubyang::Model::Choice },
  { :name => 'config',           :class => Rubyang::Model::Config },
  { :name => 'contact',          :class => Rubyang::Model::Contact },
  { :name => 'container',        :class => Rubyang::Model::Container },
  { :name => 'default',          :class => Rubyang::Model::Default },
  { :name => 'description',      :class => Rubyang::Model::Description },
  { :name => 'deviation',        :class => Rubyang::Model::Deviation },
  { :name => 'deviate',          :class => Rubyang::Model::Deviate },
  { :name => 'enum',             :class => Rubyang::Model::Enum },
  { :name => 'error-app-tag',    :class => Rubyang::Model::ErrorAppTag },
  { :name => 'error-message',    :class => Rubyang::Model::ErrorMessage },
  { :name => 'extension',        :class => Rubyang::Model::Extension },
  { :name => 'feature',          :class => Rubyang::Model::Feature },
  { :name => 'fraction-digits',  :class => Rubyang::Model::FractionDigits },
  { :name => 'grouping',         :class => Rubyang::Model::Grouping },
  { :name => 'identity',         :class => Rubyang::Model::Identity },
  { :name => 'identityref',      :class => Rubyang::Model::Identityref },
  { :name => 'if-feature',       :class => Rubyang::Model::IfFeature },
  { :name => 'import',           :class => Rubyang::Model::Import },
  { :name => 'include',          :class => Rubyang::Model::Include },
  { :name => 'input',            :class => Rubyang::Model::Input },
  { :name => 'key',              :class => Rubyang::Model::Key },
  { :name => 'leaf',             :class => Rubyang::Model::Leaf },
  { :name => 'leaf-list',        :class => Rubyang::Model::LeafList },
  { :name => 'leafref',          :class => Rubyang::Model::Leafref },
  { :name => 'length',           :class => Rubyang::Model::Length },
  { :name => 'list',             :class => Rubyang::Model::List },
  { :name => 'mandatory',        :class => Rubyang::Model::Mandatory },
  { :name => 'max-elements',     :class => Rubyang::Model::MaxElements },
  { :name => 'min-elements',     :class => Rubyang::Model::MinElements },
  { :name => 'module',           :class => Rubyang::Model::Module },
  { :name => 'must',             :class => Rubyang::Model::Must },
  { :name => 'namespace',        :class => Rubyang::Model::Namespace },
  { :name => 'notification',     :class => Rubyang::Model::Notification },
  { :name => 'ordered-by',       :class => Rubyang::Model::OrderedBy },
  { :name => 'organization',     :class => Rubyang::Model::Organization },
  { :name => 'output',           :class => Rubyang::Model::Output },
  { :name => 'path',             :class => Rubyang::Model::Path },
  { :name => 'pattern',          :class => Rubyang::Model::Pattern },
  { :name => 'position',         :class => Rubyang::Model::Position },
  { :name => 'prefix',           :class => Rubyang::Model::Prefix },
  { :name => 'presence',         :class => Rubyang::Model::Presence },
  { :name => 'range',            :class => Rubyang::Model::Range },
  { :name => 'reference',        :class => Rubyang::Model::Reference },
  { :name => 'refine',           :class => Rubyang::Model::Refine },
  { :name => 'revision',         :class => Rubyang::Model::Revision },
  { :name => 'revision-date',    :class => Rubyang::Model::RevisionDate },
  { :name => 'require-instance', :class => Rubyang::Model::RequireInstance },
  { :name => 'rpc',              :class => Rubyang::Model::Rpc },
  { :name => 'status',           :class => Rubyang::Model::Status },
  { :name => 'type',             :class => Rubyang::Model::Type },
  { :name => 'typedef',          :class => Rubyang::Model::Typedef },
  { :name => 'uses',             :class => Rubyang::Model::Uses },
  { :name => 'union',            :class => Rubyang::Model::Union },
  { :name => 'units',            :class => Rubyang::Model::Units },
  { :name => 'unique',           :class => Rubyang::Model::Unique },
  { :name => 'value',            :class => Rubyang::Model::Value },
  { :name => 'when',             :class => Rubyang::Model::When },
  { :name => 'yang-version',     :class => Rubyang::Model::YangVersion },
  { :name => 'yin-element',      :class => Rubyang::Model::YinElement },
  { :name => 'unknown',          :class => Rubyang::Model::Unknown },
]

Class Method Summary collapse

Class Method Details

.find(key) ⇒ Object



1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
# File 'lib/rubyang/model.rb', line 1109

def self.find key
  case key
  when String, Symbol
    @@stmt_map.find{ |h| h[:name] == key.to_s }[:class]
  when Class
    @@stmt_map.find{ |h| h[:class] == key }[:name]
  else
    @@stmt_map.find{ |h| h[:class] === key }[:name]
  end
end