Module: Request::Branches
- Defined in:
- lib/travis/model/request/branches.rb
Instance Method Summary collapse
- #branch_excluded?(branch) ⇒ Boolean
- #branch_included?(branch) ⇒ Boolean
- #branches_config ⇒ Object
- #excluded_branches ⇒ Object
- #included_branches ⇒ Object
Instance Method Details
#branch_excluded?(branch) ⇒ Boolean
7 8 9 |
# File 'lib/travis/model/request/branches.rb', line 7 def branch_excluded?(branch) excluded_branches && excluded_branches.include?(branch) end |
#branch_included?(branch) ⇒ Boolean
3 4 5 |
# File 'lib/travis/model/request/branches.rb', line 3 def branch_included?(branch) !included_branches || included_branches.include?(branch) end |
#branches_config ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/travis/model/request/branches.rb', line 19 def branches_config case config.try(:[], :branches) when String { :only => config[:branches].split(',').map(&:strip) } when Array { :only => config[:branches] } when Hash config[:branches] # TODO should split :only and :except values if these are strings. maybe use a specialized Hashr class. else {} end end |
#excluded_branches ⇒ Object
15 16 17 |
# File 'lib/travis/model/request/branches.rb', line 15 def excluded_branches branches_config[:except] end |
#included_branches ⇒ Object
11 12 13 |
# File 'lib/travis/model/request/branches.rb', line 11 def included_branches branches_config[:only] end |