Method: MadderLib::Phrase#initialize
- Defined in:
- lib/madderlib/phrase.rb
#initialize(builder, id = nil, *args, &block) ⇒ Phrase
Constructs a new Phrase
The containing Phrase is builder.
An optional id can be provided. The id is particularly useful in the case of:
-
relative positioning, via Builder#before or Builder#after
-
conditional usage, via Conditional::Allowed#assuming , etc.
-
positioning ranges, via AnywherePhrase#between , etc.
Any number of arguments may be provided, and they are dispatched to the say method. An optional block can be provided, and if so, it is also dispatched to say.
39 40 41 42 43 44 45 |
# File 'lib/madderlib/phrase.rb', line 39 def initialize(builder, id=nil, *args, &block) @builder, @id = builder, id @instructions = [] # don't start out with an empty instruction say *args, &block unless (args.empty?) && (! block_given?) end |