Class: SPF::Query::MacroString
- Inherits:
-
Object
- Object
- SPF::Query::MacroString
- Includes:
- Enumerable
- Defined in:
- lib/spf/query/macro_string.rb
Overview
Represents a string containing SPF macros.
Instance Method Summary collapse
-
#[](*arguments) ⇒ Array<String, Macro>, ...
Accesses the String literal or macro at the given index or range.
-
#each {|element| ... } ⇒ Enumerator
Enumerates over the macro string literals and macros.
-
#initialize(elements) ⇒ MacroString
constructor
Initializes the macro string.
-
#to_a ⇒ Array<String, Macro>
(also: #to_ary)
Converts the macro string to an Array.
-
#to_s ⇒ String
Converts the macro string to a String.
Constructor Details
#initialize(elements) ⇒ MacroString
Initializes the macro string.
16 17 18 |
# File 'lib/spf/query/macro_string.rb', line 16 def initialize(elements) @elements = elements end |
Instance Method Details
#[](*arguments) ⇒ Array<String, Macro>, ...
Accesses the String literal or macro at the given index or range.
43 44 45 |
# File 'lib/spf/query/macro_string.rb', line 43 def [](*arguments) @elements[*arguments] end |
#each {|element| ... } ⇒ Enumerator
Enumerates over the macro string literals and macros.
30 31 32 |
# File 'lib/spf/query/macro_string.rb', line 30 def each(&block) @elements.each(&block) end |
#to_a ⇒ Array<String, Macro> Also known as: to_ary
Converts the macro string to an Array.
52 53 54 |
# File 'lib/spf/query/macro_string.rb', line 52 def to_a @elements end |
#to_s ⇒ String
Converts the macro string to a String.
63 64 65 |
# File 'lib/spf/query/macro_string.rb', line 63 def to_s @elements.join end |