Class: SignalWire::SWML::Schema

Inherits:
Object
  • Object
show all
Defined in:
lib/signalwire/swml/schema.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSchema

Returns a new instance of Schema.



10
11
12
13
# File 'lib/signalwire/swml/schema.rb', line 10

def initialize
  @verbs = {}
  load_schema
end

Instance Attribute Details

#verbsObject (readonly)

Returns the value of attribute verbs.



8
9
10
# File 'lib/signalwire/swml/schema.rb', line 8

def verbs
  @verbs
end

Instance Method Details

#get_verb(name) ⇒ Object

Return the full definition hash for a verb, or nil.



31
32
33
# File 'lib/signalwire/swml/schema.rb', line 31

def get_verb(name)
  @verbs[name.to_s]
end

#valid_verb?(name) ⇒ Boolean

Is name a recognised SWML verb?

Returns:

  • (Boolean)


16
17
18
# File 'lib/signalwire/swml/schema.rb', line 16

def valid_verb?(name)
  @verbs.key?(name.to_s)
end

#verb_countObject

How many verbs are defined in the schema.



26
27
28
# File 'lib/signalwire/swml/schema.rb', line 26

def verb_count
  @verbs.size
end

#verb_namesObject

Sorted list of all known verb names.



21
22
23
# File 'lib/signalwire/swml/schema.rb', line 21

def verb_names
  @verbs.keys.sort
end