Class: Module

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

Overview

Extend facets/annotations

Instance Method Summary collapse

Instance Method Details

#cplus2ruby(hash = {}) ⇒ Object



223
224
225
226
227
228
# File 'lib/cplus2ruby/model.rb', line 223

def cplus2ruby(hash={})
  include Cplus2Ruby::Entity
  extend Cplus2Ruby::Entity
  ann! :__options__, hash 
  ann! :__options__, :order => Cplus2Ruby.model.next_order_cnt if hash[:order].nil?
end

#local_annotationsObject



21
22
23
24
25
26
27
28
29
# File 'lib/cplus2ruby.rb', line 21

def local_annotations
  new_keys = recursive_annotations().keys - self.superclass.recursive_annotations().keys
  all_keys = new_keys + annotations().keys
  h = {}
  all_keys.each do |key|
    h[key] = heritage(key)
  end
  h
end

#recursive_annotationsObject



10
11
12
13
14
15
16
17
18
19
# File 'lib/cplus2ruby.rb', line 10

def recursive_annotations
  res = {}
  ancestors.reverse.each { |ancestor|
    ancestor.annotations.each { |ref, hash|
      res[ref] ||= {}
      res[ref].update(hash) if hash
    }
  }
  res
end