Class: Jaspion::Kilza::Swift

Inherits:
Object
  • Object
show all
Includes:
Language
Defined in:
lib/jaspion/kilza/language/swift.rb,
lib/jaspion/kilza/language/swift/class.rb,
lib/jaspion/kilza/language/swift/property.rb

Overview

Swift Language parser

Defined Under Namespace

Classes: Class, Property

Constant Summary collapse

RESERVED_PROPERTY_PREFIX =
'_'
RESERVED_CLASS_POSFIX =
'Class'
RESERVED_WORDS =
%w(
  class break as associativity deinit case dynamicType
  convenience enum continue false dynamic extension default
  is didSet func do nil final import else self get init
  fallthrough Self infix internal for super inout let
  if true lazy operator in left private return mutating
  protocol switch none public where nonmutating static
  while optional struct override subscript postfix
  typealias precedence var prefix required right set
  type unowned weak id description
)
TYPES =
{
  'nilclass'    => 'AnyObject',
  'string'      => 'String',
  'fixnum'      => 'Int',
  'float'       => 'Double',
  'falseclass'  => 'Bool',
  'trueclass'   => 'Bool',
  'hash'        => 'Dictionary'
}

Instance Attribute Summary

Attributes included from Language

#base_name, #classes, #equal_keys, #json_string, #reserved_words, #types

Instance Method Summary collapse

Constructor Details

#initialize(json_string) ⇒ Swift

Returns a new instance of Swift.



32
33
34
35
36
# File 'lib/jaspion/kilza/language/swift.rb', line 32

def initialize(json_string)
  super(json_string)

  @equal_keys = 'id identifier uid'
end

Instance Method Details

#clazz(name) ⇒ Object



38
39
40
# File 'lib/jaspion/kilza/language/swift.rb', line 38

def clazz(name)
  Jaspion::Kilza::Swift::Class.new(name)
end

#property(name, type, array, key) ⇒ Object



42
43
44
# File 'lib/jaspion/kilza/language/swift.rb', line 42

def property(name, type, array, key)
  Jaspion::Kilza::Swift::Property.new(name , type, array, key)
end