phlex 2.0.0.beta2 → 2.0.0.rc1

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
  SHA256:
3
- metadata.gz: 46379514e0705957409d87f74668c2f012e03d5a48fe14f41b4100172b0672c0
4
- data.tar.gz: c4ddfa6b1c8eabfc66534abb52ca6fbe543db4d41ddf529b50fc8d0cd3393f63
3
+ metadata.gz: 4a6338c8f3742ef6e6bc493e259ba3681d9a651e79c067e030e4aaba8b889396
4
+ data.tar.gz: b0f21d0994c3ec89bb16f4037997e1327e068e7dce4b9b9bad2355df95f40de8
5
5
  SHA512:
6
- metadata.gz: 9aa416b84741e68ee9429b11c2cd2fc9dc2986ae4cc15eefff126b5f53e177aad9129cdc1349e827e54aef5c5a26f08f12017e3d200b98c5930130c4c13883fc
7
- data.tar.gz: fc0cd1de6ab7d6a6f1b76447fad84a263c9cda0ce7e0a9f4313b579c38b7246a4704a02fd183bc0b29bdc171f374070aed0e0c2933f6e06388e58696f58f2565
6
+ metadata.gz: ff0f545fe87d54db6170264df314eaf9190a1ac5718fc66e905b295c66771b61bcf76a302c94df85d1242ba804790707bb387867e25685c112e402516fb2a58e
7
+ data.tar.gz: 9b4b4615a772814e0b2bb9774802832bd007dd61a08ef5145e750fd43a5984327664050462e6f2cb82f57c9dc46d0d3858d29aa09404c62c9aa1d381c9b32b94
data/README.md CHANGED
@@ -2,21 +2,18 @@
2
2
 
3
3
  Phlex lets you compose web views in pure Ruby.
4
4
 
5
- - [1.0 Stable Docs](https://www.phlex.fun)
6
- - [2.0 Beta Docs](https://beta.phlex.fun)
5
+ - [v1 Stable Docs](https://www.phlex.fun)
6
+ - [v2 Beta Docs](https://beta.phlex.fun)
7
7
 
8
- ## Maintenance schedule
8
+ ## Versioning and Maintenance
9
9
 
10
- ### Bug fixes
10
+ Phlex does not follow semantic versioning (SemVer). Instead, we follow [BreakVer](https://www.taoensso.com/break-versioning).
11
11
 
12
- - Only the latest minor version of each major version will receive bug fixes
13
- - We may choose to fix bugs by releasing a new minor version rather than patching the existing minor version
14
- - Major versions will stop receiving bug fixes one year after the next major version is released
12
+ When a security issue is brought to our attention, we aim to release patches as soon as possible. We aim to patch with a new `non-breaking` version:
15
13
 
16
- ### Security patches
17
-
18
- - When a security issue is brought to our attention, we aim to release patches for any minor version that was released in the last year.
19
- - Additionally, the latest minor version of the latest major version will receive security patches, even if that version is over a year old.
14
+ - every `minor` version that was released in the last year;
15
+ - the latest `minor` version of the latest two `major` versions, even if over a year old; and
16
+ - the `main` branch in GitHub.
20
17
 
21
18
  ## Prior Art 🎨
22
19
 
data/lib/phlex/context.rb CHANGED
@@ -2,18 +2,19 @@
2
2
 
3
3
  # @api private
4
4
  class Phlex::Context
5
- def initialize(user_context = {})
5
+ def initialize(user_context: {}, view_context: nil)
6
6
  @buffer = +""
7
7
  @capturing = false
8
8
  @user_context = user_context
9
9
  @fragments = nil
10
10
  @in_target_fragment = false
11
11
  @halt_signal = nil
12
+ @view_context = view_context
12
13
  end
13
14
 
14
15
  attr_accessor :buffer, :capturing, :user_context, :in_target_fragment
15
16
 
16
- attr_reader :fragments
17
+ attr_reader :fragments, :view_context
17
18
 
18
19
  def target_fragments(fragments)
19
20
  @fragments = fragments.to_h { |it| [it, true] }
data/lib/phlex/csv.rb CHANGED
@@ -9,13 +9,12 @@ class Phlex::CSV
9
9
  @_headers = []
10
10
  @_current_row = []
11
11
  @_current_column_index = 0
12
- @_view_context = nil
13
12
  @_first = true
14
13
  end
15
14
 
16
15
  attr_reader :collection
17
16
 
18
- def call(buffer = +"", view_context: nil)
17
+ def call(buffer = +"", context: nil)
19
18
  unless escape_csv_injection? == true || escape_csv_injection? == false
20
19
  raise <<~MESSAGE
21
20
  You need to define escape_csv_injection? in #{self.class.name}, returning either `true` or `false`.
@@ -40,8 +39,6 @@ class Phlex::CSV
40
39
  MESSAGE
41
40
  end
42
41
 
43
- @_view_context = view_context
44
-
45
42
  each_item do |record|
46
43
  yielder(record) do |*args, **kwargs|
47
44
  view_template(*args, **kwargs)
@@ -73,12 +70,12 @@ class Phlex::CSV
73
70
 
74
71
  def column(header = nil, value)
75
72
  if @_first
76
- @_headers << escape(header)
73
+ @_headers << __escape__(header)
77
74
  elsif header != @_headers[@_current_column_index]
78
75
  raise "Inconsistent header."
79
76
  end
80
77
 
81
- @_current_row << escape(value)
78
+ @_current_row << __escape__(value)
82
79
  @_current_column_index += 1
83
80
  end
84
81
 
@@ -105,11 +102,7 @@ class Phlex::CSV
105
102
  nil
106
103
  end
107
104
 
108
- def helpers
109
- @_view_context
110
- end
111
-
112
- def escape(value)
105
+ def __escape__(value)
113
106
  value = trim_whitespace? ? value.to_s.strip : value.to_s
114
107
  first_char = value[0]
115
108
  last_char = value[-1]
data/lib/phlex/error.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # @api private
3
4
  module Phlex::Error
4
5
  end
data/lib/phlex/fifo.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # @api private
3
4
  class Phlex::FIFO
4
5
  def initialize(max_bytesize: 2_000, max_value_bytesize: 2_000)
5
6
  @store = {}
data/lib/phlex/helpers.rb CHANGED
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # @api private
3
4
  module Phlex::Helpers
4
5
  private
5
6
 
6
- # @return [Hash]
7
7
  def mix(*args)
8
8
  args.each_with_object({}) do |object, result|
9
9
  result.merge!(object) do |_key, old, new|