Class: Riml::RimlClassCommandNode
- Inherits:
-
RimlCommandNode
- Object
- Struct
- CallNode
- RimlCommandNode
- Riml::RimlClassCommandNode
- Defined in:
- lib/riml/nodes.rb
Overview
riml_import g:ClassName
Constant Summary
Constants inherited from CallNode
CallNode::ALL_BUILTIN_COMMANDS, CallNode::ALL_BUILTIN_FUNCTIONS
Constants included from Visitable
Constants included from Constants
Constants::BUILTIN_COMMANDS, Constants::BUILTIN_FUNCTIONS, Constants::COMPARISON_OPERATORS, Constants::COMPILED_STRING_LOCATION, Constants::DEFINE_KEYWORDS, Constants::END_KEYWORDS, Constants::IGNORECASE_CAPABLE_OPERATORS, Constants::KEYWORDS, Constants::REGISTERS, Constants::RIML_CLASS_COMMANDS, Constants::RIML_COMMANDS, Constants::RIML_END_KEYWORDS, Constants::RIML_FILE_COMMANDS, Constants::RIML_KEYWORDS, Constants::SPECIAL_VARIABLE_PREFIXES, Constants::SPLAT_LITERAL, Constants::UNKNOWN_LOCATION_INFO, Constants::VIML_COMMANDS, Constants::VIML_END_KEYWORDS, Constants::VIML_KEYWORDS
Instance Attribute Summary
Attributes inherited from CallNode
#arguments, #name, #scope_modifier, #super_call
Attributes included from Visitable
#compiled_output, #force_newline, #parent_node, #parser_info, #scope
Instance Method Summary collapse
- #class_names_without_modifiers ⇒ Object
-
#initialize(*args) ⇒ RimlClassCommandNode
constructor
A new instance of RimlClassCommandNode.
- #string_node_arguments ⇒ Object
Methods inherited from CallNode
#autoload?, #builtin_command?, #builtin_function?, #children, #force_newline_if_child_call_node?, #method_call?, #must_be_explicit_call?, #remove_parens_wrapper
Methods included from FullyNameable
Methods included from Visitable
#accept, #children, #force_newline_if_child_call_node?, #location_info
Methods included from Walkable
#child_after, #child_previous_to, #each, #index_by_children, #index_by_member, #insert_after, #insert_before, #next, #previous, #remove, #replace_with
Constructor Details
#initialize(*args) ⇒ RimlClassCommandNode
Returns a new instance of RimlClassCommandNode.
404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/riml/nodes.rb', line 404 def initialize(*args) super string_node_arguments.each do |arg| class_name = arg.value # if '*' isn't a char in `class_name`, raise error if class_name.index('*').nil? msg = "* must be a character in class name '#{class_name}' if riml_import " \ "is given a string. Try 'riml_import #{class_name}' instead." error = UserArgumentError.new(msg, self) raise error end end end |
Instance Method Details
#class_names_without_modifiers ⇒ Object
418 419 420 421 422 423 |
# File 'lib/riml/nodes.rb', line 418 def class_names_without_modifiers arguments.map do |full_name| full_name = full_name.value if full_name.respond_to?(:value) full_name.sub(/\A\w:/, '') end end |
#string_node_arguments ⇒ Object
425 426 427 |
# File 'lib/riml/nodes.rb', line 425 def string_node_arguments arguments.select { |arg| StringNode === arg } end |