Class: Cellophane::Main
- Inherits:
-
Object
- Object
- Cellophane::Main
- Defined in:
- lib/cellophane/main.rb
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
Returns the value of attribute command.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#project_options_file ⇒ Object
readonly
Returns the value of attribute project_options_file.
Instance Method Summary collapse
-
#initialize(args = nil) ⇒ Main
constructor
A new instance of Main.
- #run ⇒ Object
Constructor Details
#initialize(args = nil) ⇒ Main
Returns a new instance of Main.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/cellophane/main.rb', line 13 def initialize(args = nil) args ||= ARGV @project_options_file = Cellophane::PROJECT_OPTIONS_FILE @options = Cellophane::Options.parse(args) @message = 'Invalid regular expression provided.' and return if @options[:regexp] && @options[:pattern].nil? parser = Cellophane::Parser.new(@options) @features = parser.features @message = 'No features matching PATTERN were found.' and return unless @features @tags = parser. @command = generate_command end |
Instance Attribute Details
#command ⇒ Object (readonly)
Returns the value of attribute command.
11 12 13 |
# File 'lib/cellophane/main.rb', line 11 def command @command end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
11 12 13 |
# File 'lib/cellophane/main.rb', line 11 def @message end |
#project_options_file ⇒ Object (readonly)
Returns the value of attribute project_options_file.
11 12 13 |
# File 'lib/cellophane/main.rb', line 11 def @project_options_file end |
Instance Method Details
#run ⇒ Object
30 31 32 33 |
# File 'lib/cellophane/main.rb', line 30 def run puts @message and return if @message @options[:print] || @options[:version] ? puts(@command) : system("#{@command}\n\n") end |