tram-page 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c39d55da08ebcfb0ee2795121e7e0d6a96a20495
4
- data.tar.gz: 6d077605bc9ea6266773a6ba1e40144536d28bd8
3
+ metadata.gz: 2da2c8691b77724f4c2cf404654c5ef1a3c7e574
4
+ data.tar.gz: a4ad045bf0497258617b20ce47b0dfabf8e399fd
5
5
  SHA512:
6
- metadata.gz: c461d73b487fccfd57f8388e7c4acf9a37c715ff1560f92f422761f682dbf4b8e647c13a38a4a7f1bc9a9b5e1ba7b8beb6766b4704b0539938d109e7087dd638
7
- data.tar.gz: 230b8bf61933bf31376b25f4b664c511d7bc92a830a08ef029c745858959087d4bccc00cc119bf0d5d10d9eaaf34fc231ee34da65f3a5c640926fe5fd6c0be67
6
+ metadata.gz: 1019255dafb0500aa25040e48786b1463de3d0e514f63144fec24e5705128977f39137a547e21af8be92ca54c5df772bc6dbaa2ed13b035e34814cc1ae5c49dc
7
+ data.tar.gz: fde7d0cc7d8a5c7b8661931fd248bb4e55f6282ed8cca52c8b789c6176212b7d214241fba779ac0c7719a40b37d8f2f78b92306a9f9eeedea74450d376676b99
data/lib/tram/page.rb CHANGED
@@ -13,6 +13,7 @@ class Tram::Page
13
13
  if @__sections.map(&:first).include?(n)
14
14
  raise "Section #{n} already exists"
15
15
  end
16
+
16
17
  n = define_section_method(n, options)
17
18
  @__sections << [n, options]
18
19
  end
@@ -50,11 +51,17 @@ class Tram::Page
50
51
  methods = self.class.instance_variable_get(:"@__sections") || []
51
52
  except = Array(options[:except])
52
53
  only = Array(options[:only])
53
- methods.reject do |(name, _)|
54
+ methods.reject do |(name, opts)|
54
55
  (except.any? && except.include?(name)) ||
55
- (only.any? && !only.include?(name))
56
+ (only.any? && !only.include?(name)) ||
57
+ __hide?(opts)
56
58
  end
57
59
  end
60
+
61
+ def __hide?(opts)
62
+ black, white = opts.values_at(:unless, :if)
63
+ (black && public_send(black)) || (white && !public_send(white))
64
+ end
58
65
  end
59
66
 
60
67
  Tram::Page.i18n_scope = "pages"
@@ -3,6 +3,6 @@
3
3
  # rubocop:disable Style/ClassAndModuleChildren
4
4
  module Tram
5
5
  class Page
6
- VERSION = "0.1.3"
6
+ VERSION = "0.1.4"
7
7
  end
8
8
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tram-page
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Viktor Sokolov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-18 00:00:00.000000000 Z
11
+ date: 2017-08-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 2.6.11
125
+ rubygems_version: 2.6.12
126
126
  signing_key:
127
127
  specification_version: 4
128
128
  summary: Page Object pattern