Class: Divine::StructDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/divine/dsl.rb

Overview

Encapsulation basic struct information

Direct Known Subclasses

ComplexDefinition, SimpleDefinition

Instance Method Summary collapse

Constructor Details

#initialize(owner, type, args) ⇒ StructDefinition

Returns a new instance of StructDefinition.



10
11
12
13
14
# File 'lib/divine/dsl.rb', line 10

def initialize(owner, type, args)
  @owner = owner
  @type = type
  @args = args
end

Instance Method Details

#nameObject

Get struct’s name



19
20
21
# File 'lib/divine/dsl.rb', line 19

def name
  @args.first
end

#to_sObject

Represents strut as string



37
38
39
# File 'lib/divine/dsl.rb', line 37

def to_s
  "#{@owner.name}: #{self.type} #{self.name} (#{self.class.name}, #{@args.inspect})"
end

#typeObject



23
24
25
# File 'lib/divine/dsl.rb', line 23

def type
  @type
end

#versionObject

Get struct’s version



30
31
32
# File 'lib/divine/dsl.rb', line 30

def version 
  @owner.version
end