Class: RedShift::TransitionSyntax::EventBlockParser
- Defined in:
- lib/redshift/syntax.rb
Instance Attribute Summary collapse
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Instance Method Summary collapse
-
#initialize(block) ⇒ EventBlockParser
constructor
A new instance of EventBlockParser.
- #literal(val) ⇒ Object
- #method_missing(event_name, *args, &bl) ⇒ Object
Constructor Details
#initialize(block) ⇒ EventBlockParser
Returns a new instance of EventBlockParser.
307 308 309 310 |
# File 'lib/redshift/syntax.rb', line 307 def initialize(block) @events = [] instance_eval(&block) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(event_name, *args, &bl) ⇒ Object
295 296 297 298 299 300 301 302 303 304 305 |
# File 'lib/redshift/syntax.rb', line 295 def method_missing event_name, *args, &bl if args.size > 1 or (args.size == 1 and bl) raise SyntaxError, "Too many arguments in event specifier" end item = Component::EventPhaseItem.new item.event = event_name item.value = bl || (args.size > 0 && args[0]) || true @events << item end |
Instance Attribute Details
#events ⇒ Object (readonly)
Returns the value of attribute events.
293 294 295 |
# File 'lib/redshift/syntax.rb', line 293 def events @events end |