Class: DSL

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDSL

Returns a new instance of DSL.



62
63
64
# File 'lib/interface_semantics.rb', line 62

def initialize
  @attributes = []
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, **kwargs) ⇒ Object



66
67
68
# File 'lib/interface_semantics.rb', line 66

def method_missing(name, *args, **kwargs)
  attributes << Attribute.new(name, args[0..-2], args.last)
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



54
55
56
# File 'lib/interface_semantics.rb', line 54

def attributes
  @attributes
end

Class Method Details

.run(&block) ⇒ Object



56
57
58
59
60
# File 'lib/interface_semantics.rb', line 56

def self.run(&block)
  dsl = new
  dsl.instance_eval(&block)
  dsl.attributes
end