class IDL::AST::Annotation
Attributes
fields[R]
id[R]
Public Class Methods
new(id, fields = {})
click to toggle source
# File lib/ridl/node.rb, line 17 def initialize(id, fields = {}) @id = id.to_sym # copy field map transforming all keys to symbols and # detecting nested annotation objects @fields = fields.inject({}) do |m, (k, v)| m[k.to_sym] = case v when Array v.collect { |ve| Hash === ve ? Annotation.new(*ve.to_a.first) : ve } when Hash Annotation.new(*v.to_a.first) else v end m end end
Public Instance Methods
[](fieldid)
click to toggle source
# File lib/ridl/node.rb, line 40 def [](fieldid) @fields[(fieldid || '').to_sym] end
each(&block)
click to toggle source
# File lib/ridl/node.rb, line 44 def each(&block) @fields.each(&block) end
is_marker?()
click to toggle source
# File lib/ridl/node.rb, line 36 def is_marker? @fields.empty? end