Class: PodsOrz::PodfileModel
- Inherits:
-
Object
- Object
- PodsOrz::PodfileModel
- Defined in:
- lib/podsorz/core/PodFile/podfile_model.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#configurations ⇒ Object
Returns the value of attribute configurations.
-
#git ⇒ Object
Returns the value of attribute git.
-
#modular_headers ⇒ Object
Returns the value of attribute modular_headers.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#podspec ⇒ Object
Returns the value of attribute podspec.
-
#subspecs ⇒ Object
Returns the value of attribute subspecs.
-
#tag ⇒ Object
Returns the value of attribute tag.
-
#version ⇒ Object
Returns the value of attribute version.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(sentence) ⇒ PodfileModel
constructor
A new instance of PodfileModel.
Constructor Details
#initialize(sentence) ⇒ PodfileModel
Returns a new instance of PodfileModel.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 23 def initialize(sentence) sentence_slip_list = sentence.split(',') return if sentence_slip_list.size.zero? for piece in sentence_slip_list do if /:git =>/ =~ piece @git = $~.post_match.strip elsif /:path =>/ =~ piece @path = $~.post_match.strip elsif /:configurations =>/ =~ piece @configurations = $~.post_match.strip elsif /:modular_headers =>/ =~ piece @modular_headers = $~.post_match.strip elsif /:branch =>/ =~ piece @branch = $~.post_match.strip elsif /:tag =>/ =~ piece @tag = $~.post_match.strip elsif /pod /=~ piece @name = $~.post_match.delete("'\n ") elsif /:subspecs =>/ =~ piece @subspecs = $~.post_match.strip else mt = /\'\d{1,}\..*\d{1,}\'/.match(piece) @version = mt[0].gsub(/[\'\"]/, "") unless mt.nil? end end # puts %Q{model name:#{@name},git:#{@git},path:#{@path},config:#{@configurations},branch:#{@branch},tag:#{@tag}} end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def branch @branch end |
#configurations ⇒ Object
Returns the value of attribute configurations.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def configurations @configurations end |
#git ⇒ Object
Returns the value of attribute git.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def git @git end |
#modular_headers ⇒ Object
Returns the value of attribute modular_headers.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def modular_headers @modular_headers end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def path @path end |
#podspec ⇒ Object
Returns the value of attribute podspec.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def podspec @podspec end |
#subspecs ⇒ Object
Returns the value of attribute subspecs.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def subspecs @subspecs end |
#tag ⇒ Object
Returns the value of attribute tag.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def tag @tag end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 6 def version @version end |
Class Method Details
.validate_podfile_sentence_instance(sentence) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/podsorz/core/PodFile/podfile_model.rb', line 8 def self.validate_podfile_sentence_instance(sentence) result_model = nil sentence = sentence.strip.chomp unless sentence.empty? || sentence.size.zero? unless sentence.start_with?("#") if sentence.start_with?("pod ") result_model = PodsOrz::PodfileModel.new(sentence) end end end result_model end |