module Snapi

Constants

Function

Functions are a core part of capability declaration as a capability is basically a collection of functions.

Functions take arguments and return a pre-defined type of data structure.

Right now Functions are structs which accept arguments and return_type messages as well as a few DSL methods to help define them dynamically

InvalidArgumentAttributeError

_ ___ ___ | _| _ \ _ \ _ | _ ___ / | | |__ | |_/ / |_/ / | | | |_/ / / /| | | __|| /| /| | | | / / / | | | |_| |\ | |\ \ _/ / |\ ./ /_|| ___/| __| _|__/| ___()

InvalidBooleanError
InvalidCapabilityError
InvalidDescriptionError
InvalidFormatError
InvalidFunctionCallError
InvalidFunctionNameError
InvalidReturnTypeError
InvalidStringError
InvalidTypeError
InvalidValuesError
LibraryClassMissingFunctionError
MissingValuesError
PendingBranchError

TODO remove

VERSION

Public Class Methods

[](key) click to toggle source
# File lib/snapi.rb, line 18
def self.[](key)
  @@capabilities[key]
end
capabilities() click to toggle source
# File lib/snapi.rb, line 14
def self.capabilities
  @@capabilities
end
capability_hash() click to toggle source
# File lib/snapi.rb, line 30
def self.capability_hash
  valid_capabilities.each_with_object({}) do |cap,coll|
    coll[cap] = Snapi[cap].to_hash
  end
end
has_capability?(capability) click to toggle source
# File lib/snapi.rb, line 36
def self.has_capability?(capability)
  valid_capabilities.include?(capability)
end
register_capability(klass) click to toggle source
# File lib/snapi.rb, line 22
def self.register_capability(klass)
  @@capabilities[klass.namespace] = klass
end
supports?(capability,function,params) click to toggle source
# File lib/snapi.rb, line 40
def self.supports?(capability,function,params)
  if Snapi.has_capability?(capability) &&
     Snapi[capability].valid_function_call?(function, params)
    true
  else
    false
  end
end
valid_capabilities() click to toggle source
# File lib/snapi.rb, line 26
def self.valid_capabilities
  @@capabilities.keys
end