class FFIDB::Function
Public Instance Methods
arity()
click to toggle source
@return [Integer]
# File lib/ffidb/function.rb, line 46 def arity() self.parameters.size end
binary?()
click to toggle source
@return [Boolean]
# File lib/ffidb/function.rb, line 38 def binary?() self.arity.equal?(2) end
function?()
click to toggle source
@return [Boolean]
# File lib/ffidb/function.rb, line 18 def function?() return true end
nonpublic?()
click to toggle source
@return [Boolean]
# File lib/ffidb/function.rb, line 26 def nonpublic?() !(self.public?) end
nullary?()
click to toggle source
@return [Boolean]
# File lib/ffidb/function.rb, line 30 def nullary?() self.arity.zero? end
public?()
click to toggle source
@return [Boolean]
# File lib/ffidb/function.rb, line 22 def public?() self.name[0] != '_' end
ternary?()
click to toggle source
@return [Boolean]
# File lib/ffidb/function.rb, line 42 def ternary?() self.arity.equal?(3) end
to_h()
click to toggle source
@return [Hash<Symbol, Object>]
# File lib/ffidb/function.rb, line 50 def to_h { name: self.name.to_s, type: self.type.to_s, parameters: self.parameters&.transform_values { |v| v.type.to_s }, definition: self.definition&.to_h, comment: self.comment, }.delete_if { |k, v| v.nil? } end
to_yaml()
click to toggle source
@return [String]
# File lib/ffidb/function.rb, line 62 def to_yaml h = self.to_h h.delete(:parameters) if h[:parameters].empty? 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
unary?()
click to toggle source
@return [Boolean]
# File lib/ffidb/function.rb, line 34 def unary?() self.arity.equal?(1) end