Class: DSL
- Inherits:
-
Object
- Object
- DSL
- Defined in:
- lib/interface_semantics.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #method_missing(name, *args, **kwargs) ⇒ Object
Constructor Details
#initialize ⇒ DSL
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
#attributes ⇒ Object (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 |