Class: Terse::Keyword
- Inherits:
-
Object
- Object
- Terse::Keyword
- Defined in:
- lib/terse/keyword.rb
Overview
A class storing all information about a keyword & what it should be transformed into
Direct Known Subclasses
Instance Attribute Summary collapse
-
#follow_on_regex ⇒ Object
Returns the value of attribute follow_on_regex.
-
#follow_on_substitute ⇒ Object
Returns the value of attribute follow_on_substitute.
-
#is_end ⇒ Object
Returns the value of attribute is_end.
-
#keyword ⇒ Object
Returns the value of attribute keyword.
-
#needs_inner_end ⇒ Object
Returns the value of attribute needs_inner_end.
-
#needs_inner_start ⇒ Object
Returns the value of attribute needs_inner_start.
-
#needs_line_ending ⇒ Object
some keywords naturally imply that the line should have a line-ending, e.g.
-
#needs_top_level_end ⇒ Object
Returns the value of attribute needs_top_level_end.
-
#needs_top_level_start ⇒ Object
Returns the value of attribute needs_top_level_start.
-
#regex ⇒ Object
Returns the value of attribute regex.
-
#substitute ⇒ Object
Returns the value of attribute substitute.
-
#try_follow_on_regex ⇒ Object
Returns the value of attribute try_follow_on_regex.
Instance Method Summary collapse
-
#initialize(keyword) ⇒ Keyword
constructor
A new instance of Keyword.
Constructor Details
#initialize(keyword) ⇒ Keyword
Returns a new instance of Keyword.
22 23 24 25 26 |
# File 'lib/terse/keyword.rb', line 22 def initialize(keyword) @keyword = keyword @regex = gen_regex_from_keyword keyword @follow_on_regex = gen_regex_from_keyword_including_follow_on keyword end |
Instance Attribute Details
#follow_on_regex ⇒ Object
Returns the value of attribute follow_on_regex.
8 9 10 |
# File 'lib/terse/keyword.rb', line 8 def follow_on_regex @follow_on_regex end |
#follow_on_substitute ⇒ Object
Returns the value of attribute follow_on_substitute.
9 10 11 |
# File 'lib/terse/keyword.rb', line 9 def follow_on_substitute @follow_on_substitute end |
#is_end ⇒ Object
Returns the value of attribute is_end.
15 16 17 |
# File 'lib/terse/keyword.rb', line 15 def is_end @is_end end |
#keyword ⇒ Object
Returns the value of attribute keyword.
5 6 7 |
# File 'lib/terse/keyword.rb', line 5 def keyword @keyword end |
#needs_inner_end ⇒ Object
Returns the value of attribute needs_inner_end.
14 15 16 |
# File 'lib/terse/keyword.rb', line 14 def needs_inner_end @needs_inner_end end |
#needs_inner_start ⇒ Object
Returns the value of attribute needs_inner_start.
12 13 14 |
# File 'lib/terse/keyword.rb', line 12 def needs_inner_start @needs_inner_start end |
#needs_line_ending ⇒ Object
some keywords naturally imply that the line should have a line-ending, e.g. ; for Java line-endings should not be applied if the keyword indicates the start/end of a class/method/block, etc. Internally, :needs_top_level_end and :needs_inner_end take priority over :needs_line_ending
20 21 22 |
# File 'lib/terse/keyword.rb', line 20 def needs_line_ending @needs_line_ending end |
#needs_top_level_end ⇒ Object
Returns the value of attribute needs_top_level_end.
13 14 15 |
# File 'lib/terse/keyword.rb', line 13 def needs_top_level_end @needs_top_level_end end |
#needs_top_level_start ⇒ Object
Returns the value of attribute needs_top_level_start.
11 12 13 |
# File 'lib/terse/keyword.rb', line 11 def needs_top_level_start @needs_top_level_start end |
#regex ⇒ Object
Returns the value of attribute regex.
7 8 9 |
# File 'lib/terse/keyword.rb', line 7 def regex @regex end |
#substitute ⇒ Object
Returns the value of attribute substitute.
6 7 8 |
# File 'lib/terse/keyword.rb', line 6 def substitute @substitute end |
#try_follow_on_regex ⇒ Object
Returns the value of attribute try_follow_on_regex.
10 11 12 |
# File 'lib/terse/keyword.rb', line 10 def try_follow_on_regex @try_follow_on_regex end |