Class: Transpec::Syntax::RSpecConfigure
- Inherits:
-
Syntax
- Object
- Syntax
- Transpec::Syntax::RSpecConfigure
show all
- Defined in:
- lib/transpec/syntax/rspec_configure.rb
Defined Under Namespace
Classes: FrameworkConfiguration, UnknownSyntaxError
Class Method Summary
collapse
Class Method Details
.add_framework_configuration(type, config_method_name) ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/transpec/syntax/rspec_configure.rb', line 92
def self.add_framework_configuration(type, config_method_name)
class_eval <<-END
def #{type}_syntaxes
#{type}_framework_configuration.syntaxes
end
def modify_#{type}_syntaxes!(syntaxes)
#{type}_framework_configuration.modify_syntaxes!(syntaxes)
end
def #{type}_framework_configuration
@#{type}_framework_configuration ||=
FrameworkConfiguration.new(node, :#{config_method_name}, source_rewriter)
end
END
end
|
.target_node?(node) ⇒ Boolean
85
86
87
88
89
90
|
# File 'lib/transpec/syntax/rspec_configure.rb', line 85
def self.target_node?(node)
return false unless node.type == :block
send_node = node.children.first
receiver_node, method_name, *_ = *send_node
Util.const_name(receiver_node) == 'RSpec' && method_name == :configure
end
|