diff options
| author | skv <skv-headless@yandex.ru> | 2014-08-02 19:12:01 +0400 |
|---|---|---|
| committer | skv <skv-headless@yandex.ru> | 2014-08-14 15:48:14 +0400 |
| commit | 4e4080016604e2c7ca9a5e75d6dd37d34b99cb09 (patch) | |
| tree | 1a443fc6b7a16828c8a4b92d1724c2f72a4024f4 /lib | |
| parent | fdd8e4507527badd875a40a0ab8a3ed47a03c764 (diff) | |
| download | gitlab-ce-4e4080016604e2c7ca9a5e75d6dd37d34b99cb09.tar.gz | |
diff unfold
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/gitlab/diff_parser.rb | 2 | ||||
| -rw-r--r-- | lib/gt_one_coercion.rb | 5 | ||||
| -rw-r--r-- | lib/unfold_form.rb | 11 |
3 files changed, 17 insertions, 1 deletions
diff --git a/lib/gitlab/diff_parser.rb b/lib/gitlab/diff_parser.rb index 14bbb328637..b244295027e 100644 --- a/lib/gitlab/diff_parser.rb +++ b/lib/gitlab/diff_parser.rb @@ -30,7 +30,7 @@ module Gitlab line_new = line.match(/\+[0-9]*/)[0].to_i.abs rescue 0 next if line_old == 1 && line_new == 1 #top of file - yield(full_line, type, nil, nil, nil) + yield(full_line, type, nil, line_new, line_old) next else type = identification_type(line) diff --git a/lib/gt_one_coercion.rb b/lib/gt_one_coercion.rb new file mode 100644 index 00000000000..ef2dc09767c --- /dev/null +++ b/lib/gt_one_coercion.rb @@ -0,0 +1,5 @@ +class GtOneCoercion < Virtus::Attribute + def coerce(value) + [1, value.to_i].max + end +end diff --git a/lib/unfold_form.rb b/lib/unfold_form.rb new file mode 100644 index 00000000000..46b12beeaaf --- /dev/null +++ b/lib/unfold_form.rb @@ -0,0 +1,11 @@ +require_relative 'gt_one_coercion' + +class UnfoldForm + include Virtus.model + + attribute :since, GtOneCoercion + attribute :to, GtOneCoercion + attribute :bottom, Boolean + attribute :unfold, Boolean, default: true + attribute :offset, Integer +end |
