partial_menu 1.0.1 → 1.1.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
  SHA1:
3
- metadata.gz: 2714223d904bafa97e9f92736314f96bf06f6e66
4
- data.tar.gz: 85215decc146153e1873d643563f502991c87868
3
+ metadata.gz: c2f7cfdeda9acf5869bd136fced7856ee245acc7
4
+ data.tar.gz: 3f39a8d84a7ec4b7d534c95dd4f2ec9b9b2b0506
5
5
  SHA512:
6
- metadata.gz: 6a2ec14fb7443b91e39d4fab6def404cc89dfaf76ad7e36db48ad0946d610ab8c9443096926abc39bc942232f33de82a12568683c4c5fa2f5182e48bb9b0bc8f
7
- data.tar.gz: 1a879c100269a83d747b20fdb4c0dcafff8c612b5dfc46b38c892425cb2a19847b0a61aa87119b686e792e40ba9259f129356585093bf82871d1ec99e9b44042
6
+ metadata.gz: ba658e35aa77abdb76429d4e3aec439fc1f5363f5c1b701597e5fed5e92d4bc34d2ce67747ced90052eaeb60e931e53cd975eda99f69cfca3e784e99d3e953d4
7
+ data.tar.gz: 7093377f04f556579552643905f303de8e2f1bbffffc342ce1a062bb822ffa3cd177ed70a2cb3df4b9a1aae73bc9b6391a94d4206cf7e1c60069003e6d19b013
@@ -1,3 +1,3 @@
1
1
  module PartialMenu
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
@@ -48,7 +48,12 @@ module PartialMenu
48
48
  options = type
49
49
  type = 'main'
50
50
  end
51
- options[:menu] = PartialMenu::Menu.new(load_menu_from_yaml(type), type)
51
+ options[:menu] = PartialMenu::Menu.new(
52
+ load_menu_from_yaml(
53
+ get_yaml_prefix(type, options)
54
+ ),
55
+ type
56
+ )
52
57
  options.deep_symbolize_keys!
53
58
  render partial: "#{type}_menu/menu", locals: options
54
59
  end
@@ -56,23 +61,27 @@ module PartialMenu
56
61
 
57
62
  private
58
63
 
64
+ def get_yaml_prefix(prefix, options)
65
+ options[:yaml] || prefix
66
+ end
67
+
59
68
  ##
60
69
  # Load yaml file from config
61
70
  #
62
71
  # The +type+ parameter is used to create te actual file name. It is
63
72
  # expected to:
64
73
  # * be in the Rails apps config/ folder
65
- # * have a name like +type>_menu.yml+
74
+ # * have a name like +<prefix>_menu.yml+
66
75
  #
67
76
  # All keys are symbolized after loading hte file.
68
77
  #
69
- # @param [String] type The menu type, which identifies the file too
78
+ # @param [String] type The yaml file's name prefix
70
79
  #
71
80
  # @return [Hash] The parsed YAML as hash of objects
72
81
  #
73
- def load_menu_from_yaml(type)
82
+ def load_menu_from_yaml(prefix)
74
83
  Psych.load_file(
75
- Rails.root.join("config/#{type}_menu.yml")
84
+ Rails.root.join("config/#{prefix}_menu.yml")
76
85
  ).deep_symbolize_keys[:menu]
77
86
  end
78
87
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: partial_menu
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Nagy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-17 00:00:00.000000000 Z
11
+ date: 2018-08-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_link_to