Class: Ruber::RSpec::ProjectWidget
- Inherits:
-
ProjectConfigWidget
- Object
- Qt::Widget
- ProjectConfigWidget
- Ruber::RSpec::ProjectWidget
- Defined in:
- plugins/rspec/rspec.rb,
plugins/rspec/rspec.rb
Overview
Project widget for the RSpec frontend plugin
Instance Attribute Summary
Attributes inherited from ProjectConfigWidget
Instance Method Summary (collapse)
-
- (ProjectWidget) initialize(prj)
constructor
A new instance of ProjectWidget.
-
- (Array<String>) pattern
private
Parses the content of the pattern widget.
-
- (Object) pattern(value)
private
Sets the text of the pattern widget the text to put in the widget.
-
- (Array<Hash>) patterns
private
Parses the content of the pattern widget.
-
- (Object) patterns(value)
private
Sets the text of the pattern widget the text to put in the widget.
-
- (Array<String>) spec_options
private
Parses the text of the “RSpec options” widget.
-
- (Object) spec_options(value)
private
Changes the text of the “RSpec options” widget.
- - (Boolean) text_glob?(text) private
API for feature rspec
Constructor Details
- (ProjectWidget) initialize(prj)
A new instance of ProjectWidget
976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 |
# File 'plugins/rspec/rspec.rb', line 976 def initialize prj super @ui = Ui::RSpecProjectWidget.new @ui.setupUi self view = @ui._rspec__patterns mod = Qt::StandardItemModel.new view.model = mod mod.horizontal_header_labels = ['Code file', 'Spec file'] @ui.add_pattern.connect(SIGNAL(:clicked)) do row = [Qt::StandardItem.new, Qt::StandardItem.new] mod.append_row row view.current_index = row[0].index view.edit row[0].index end @ui.remove_pattern.connect(SIGNAL(:clicked)) do sel = view.selection_model.selected_indexes mod.remove_row sel[0].row end view.selection_model.connect(SIGNAL('selectionChanged(QItemSelection,QItemSelection)')) do @ui.remove_pattern.enabled = view.selection_model.has_selection end end |
Instance Method Details
- (Array<String>) pattern (private)
Parses the content of the pattern widget
997 998 999 |
# File 'plugins/rspec/rspec.rb', line 997 def pattern @ui._rspec__spec_pattern.text.split(/;\s*/) end |
- (Object) pattern=(value) (private)
Sets the text of the pattern widget the text to put in the widget
989 990 991 |
# File 'plugins/rspec/rspec.rb', line 989 def pattern= value value.join ', ' end |
- (Array<Hash>) patterns (private)
Parses the content of the pattern widget
688 689 690 691 692 693 694 |
# File 'plugins/rspec/rspec.rb', line 688 def patterns mod = @ui._rspec__patterns.model mod.each_row.map do |cols| code = cols[0].text {:code => code, :spec => cols[1].text, :glob => text_glob?(code)} end end |
- (Object) patterns=(value) (private)
Sets the text of the pattern widget the text to put in the widget
674 675 676 677 678 679 680 681 682 |
# File 'plugins/rspec/rspec.rb', line 674 def patterns= value view = @ui._rspec__patterns value.each do |h| row = [Qt::StandardItem.new(h[:code]), Qt::StandardItem.new(h[:spec])] view.model.append_row row end 2.times{|i| view.resize_column_to_contents i} end |
- (Array<String>) spec_options (private)
Parses the text of the “RSpec options” widget
quotes around them keep them, as described in Shellwords.split_with_quotes)
1017 1018 1019 |
# File 'plugins/rspec/rspec.rb', line 1017 def Shellwords.split_with_quotes @ui..text end |
- (Object) spec_options=(value) (private)
Changes the text of the “RSpec options” widget
spaces
1007 1008 1009 |
# File 'plugins/rspec/rspec.rb', line 1007 def value @ui..text = value.join ' ' end |
- (Boolean) text_glob?(text) (private)
696 697 698 |
# File 'plugins/rspec/rspec.rb', line 696 def text_glob? text text=~ /[*?{}\[\]]/ end |