Class: Interface

Inherits:
Object
  • Object
show all
Defined in:
lib/shed/interface.rb

Overview

ActionScript 3 Interface Parser. Tokenises the contents of an interface into hashes.

All methods and properties are stored in Hashes. Details of methods can be obtained via :name String, :arguments Array, return: String. Properies have the keys :name String, :gets Boolean, :sets Boolean, and :type String.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(string) ⇒ Interface

Returns a new instance of Interface.



18
19
20
21
22
23
24
25
26
# File 'lib/shed/interface.rb', line 18

def initialize(string)
  @doc = Stripper.ecma_comments(string)

  @properties, @methods = {}, {}
  @package, @name = '', ''

  raise "Document is not an interface" unless is_valid
  parse
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



12
13
14
# File 'lib/shed/interface.rb', line 12

def class_name
  @class_name
end

#methodsObject (readonly)

Returns the value of attribute methods.



12
13
14
# File 'lib/shed/interface.rb', line 12

def methods
  @methods
end

#nameObject (readonly)

Returns the value of attribute name.



12
13
14
# File 'lib/shed/interface.rb', line 12

def name
  @name
end

#packageObject (readonly)

Returns the value of attribute package.



12
13
14
# File 'lib/shed/interface.rb', line 12

def package
  @package
end

#propertiesObject (readonly)

Returns the value of attribute properties.



12
13
14
# File 'lib/shed/interface.rb', line 12

def properties
  @properties
end

Instance Method Details

#get_method(name) ⇒ Object

Returns the method hash associated with request name.



31
32
33
# File 'lib/shed/interface.rb', line 31

def get_method(name)
  @methods[name]
end

#get_property(name) ⇒ Object

Returns the proptert hash associated with request name.



38
39
40
# File 'lib/shed/interface.rb', line 38

def get_property(name)
  @properties[name]
end