Class: Phut::Syntax::Directive
- Inherits:
-
Object
- Object
- Phut::Syntax::Directive
- Defined in:
- lib/phut/syntax/directive.rb
Overview
Common DSL directive
Direct Known Subclasses
Class Method Summary collapse
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#method_missing(name) ⇒ Object
rubocop:disable MethodMissing.
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name) ⇒ Object
rubocop:disable MethodMissing
18 19 20 |
# File 'lib/phut/syntax/directive.rb', line 18 def method_missing(name) @attributes.fetch name.to_sym end |
Class Method Details
.attribute(name) ⇒ Object
7 8 9 10 11 |
# File 'lib/phut/syntax/directive.rb', line 7 def self.attribute(name) define_method(name) do |value| @attributes[name] = value end end |
Instance Method Details
#[](key) ⇒ Object
13 14 15 |
# File 'lib/phut/syntax/directive.rb', line 13 def [](key) @attributes[key] end |