fino 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee8bdd56792ffd6eed11da668a8df8785c85cc59d1bad28789131be52b7d4fe3
4
- data.tar.gz: b3d2732be842a1f04dde6faa88c89c43a39198d017e94fc8939aa3a6bec09d5a
3
+ metadata.gz: 23a8486cb9d7c402ff499051da385a911437dd8a4d9a49df5712ef3e439f0b0d
4
+ data.tar.gz: cdd83bdb9542a59f4c0e4f409e76231a40028acf25e2293de84e45873c296b26
5
5
  SHA512:
6
- metadata.gz: 6a24212d5ee902d515e6566a83473e4e2a980b0dc294da36071d5b6effb8c82acf3f3836c6beefce4880dc64ff43b4df56a53e366cb9c685ffdddc0c61f26f46
7
- data.tar.gz: 27b249d2c12c74192af82b6260335044bb2fa89cd8d97d033bd4838b372c0b5e9e5c0a989544a442e7b44fda957b3925f0ed82c0317fed458a3115daa024bd9b
6
+ metadata.gz: 59315d14709d165cfe989d66324ca823f8fb13cd8c140246d6bb9542876d49446a9b52654ac15b34b39a7bdb8f9b79bba9e4d065ab8e9d35e2150a3862f32e7d
7
+ data.tar.gz: a9fc49c4e631b8a6812ff51401597591886a42e6a354feed62bdd8e308a1ebef66469485fdc83e647ad53e1a057d5860411e5ff4c15193b6a57fe72b7910b041
@@ -28,13 +28,11 @@ class Fino::Definition::Setting
28
28
  end
29
29
 
30
30
  def default
31
- return @default if defined?(@default)
32
-
33
- @default = options[:default]
31
+ defined?(@default) ? @default : @default = options[:default]
34
32
  end
35
33
 
36
34
  def description
37
- options[:description]
35
+ defined?(@description) ? @description : @description = options[:description]
38
36
  end
39
37
 
40
38
  def path
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Fino::Settings::Float
4
4
  include Fino::Setting
5
+ include Fino::Settings::Numeric
5
6
 
6
7
  self.type_identifier = :float
7
8
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  class Fino::Settings::Integer
4
4
  include Fino::Setting
5
+ include Fino::Settings::Numeric
5
6
 
6
7
  self.type_identifier = :integer
7
8
 
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Fino::Settings::Numeric
4
+ module Unit
5
+ class Generic
6
+ attr_reader :name, :short_name
7
+
8
+ def initialize(name, short_name = nil)
9
+ @name = name
10
+ @short_name = short_name || name
11
+ end
12
+ end
13
+
14
+ class Milliseconds < Generic
15
+ def initialize = super("Milliseconds", "ms")
16
+ end
17
+
18
+ module_function
19
+
20
+ def for(identifier)
21
+ case identifier
22
+ when :ms
23
+ Milliseconds.new
24
+ else
25
+ Generic.new(identifier.to_s.capitalize)
26
+ end
27
+ end
28
+ end
29
+
30
+ def unit
31
+ return unless (identifier = definition.options[:unit])
32
+
33
+ @unit ||= Unit.for(identifier)
34
+ end
35
+
36
+ private
37
+
38
+ def inspectable_attributes
39
+ additional_attributes = {}
40
+ additional_attributes[:unit] = unit.short_name if unit
41
+
42
+ super.merge(additional_attributes)
43
+ end
44
+ end
data/lib/fino/solid.rb CHANGED
@@ -19,7 +19,4 @@ require "fino/solid/setting"
19
19
  require "fino/solid/adapter"
20
20
  require "fino/solid/railtie" if defined?(Rails::Railtie)
21
21
 
22
- if defined?(Rails) && defined?(Rails::Generators)
23
- require "rails/generators"
24
- require_relative "solid/generators/install/install_generator"
25
- end
22
+ require "fino/solid/generators/install/install_generator"
data/lib/fino/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fino
4
- VERSION = "1.4.0"
4
+ VERSION = "1.5.0"
5
5
  REQUIRED_RUBY_VERSION = ">= 3.0.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fino
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Egor Iskrenkov
@@ -58,6 +58,7 @@ files:
58
58
  - lib/fino/settings/boolean.rb
59
59
  - lib/fino/settings/float.rb
60
60
  - lib/fino/settings/integer.rb
61
+ - lib/fino/settings/numeric.rb
61
62
  - lib/fino/settings/section.rb
62
63
  - lib/fino/settings/string.rb
63
64
  - lib/fino/solid.rb