Module: FFIDB::Symbolic
- Includes:
- Comparable
- Defined in:
- lib/ffidb/symbolic.rb
Instance Method Summary collapse
- #<=>(other) ⇒ Integer
- #enum? ⇒ Boolean
- #function? ⇒ Boolean
- #kind ⇒ Symbol
- #kind_weight ⇒ Integer
- #struct? ⇒ Boolean
- #to_yaml ⇒ String
- #typedef? ⇒ Boolean
- #union? ⇒ Boolean
Instance Method Details
#<=>(other) ⇒ Integer
10 11 12 |
# File 'lib/ffidb/symbolic.rb', line 10 def <=>(other) self.name <=> other.name end |
#enum? ⇒ Boolean
44 |
# File 'lib/ffidb/symbolic.rb', line 44 def enum?() return false end |
#function? ⇒ Boolean
56 |
# File 'lib/ffidb/symbolic.rb', line 56 def function?() return false end |
#kind ⇒ Symbol
16 17 18 19 20 21 22 23 24 |
# File 'lib/ffidb/symbolic.rb', line 16 def kind case when self.typedef? then :typedef when self.enum? then :enum when self.struct? then :struct when self.union? then :union when self.function? then :function end end |
#kind_weight ⇒ Integer
28 29 30 31 32 33 34 35 36 |
# File 'lib/ffidb/symbolic.rb', line 28 def kind_weight case when self.typedef? then 1 when self.enum? then 2 when self.struct? then 3 when self.union? then 4 when self.function? then 5 end end |
#struct? ⇒ Boolean
48 |
# File 'lib/ffidb/symbolic.rb', line 48 def struct?() return false end |
#to_yaml ⇒ String
60 61 62 63 64 65 |
# File 'lib/ffidb/symbolic.rb', line 60 def to_yaml h = self.to_h h.transform_keys!(&:to_s) h.transform_values! { |v| v.is_a?(Hash) ? v.transform_keys!(&:to_s) : v } YAML.dump(h).gsub!("---\n", "--- !#{self.kind}\n") end |
#typedef? ⇒ Boolean
40 |
# File 'lib/ffidb/symbolic.rb', line 40 def typedef?() return false end |
#union? ⇒ Boolean
52 |
# File 'lib/ffidb/symbolic.rb', line 52 def union?() return false end |