Class: Avmtrf1::Ini::Profile
- Inherits:
-
Object
- Object
- Avmtrf1::Ini::Profile
- Includes:
- EacRubyUtils::SimpleCache
- Defined in:
- lib/avmtrf1/ini/profile.rb
Instance Attribute Summary collapse
-
#ini ⇒ Object
readonly
Returns the value of attribute ini.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent_name ⇒ Object
readonly
Returns the value of attribute parent_name.
-
#self_data ⇒ Object
readonly
Returns the value of attribute self_data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #fetch(key) ⇒ Object
-
#initialize(ini, name, parent_name, self_data) ⇒ Profile
constructor
A new instance of Profile.
- #to_h(prefix = '') ⇒ Object
Constructor Details
#initialize(ini, name, parent_name, self_data) ⇒ Profile
Returns a new instance of Profile.
13 14 15 16 17 18 |
# File 'lib/avmtrf1/ini/profile.rb', line 13 def initialize(ini, name, parent_name, self_data) @ini = ini @name = name @parent_name = parent_name @self_data = self_data end |
Instance Attribute Details
#ini ⇒ Object (readonly)
Returns the value of attribute ini.
10 11 12 |
# File 'lib/avmtrf1/ini/profile.rb', line 10 def ini @ini end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
10 11 12 |
# File 'lib/avmtrf1/ini/profile.rb', line 10 def name @name end |
#parent_name ⇒ Object (readonly)
Returns the value of attribute parent_name.
10 11 12 |
# File 'lib/avmtrf1/ini/profile.rb', line 10 def parent_name @parent_name end |
#self_data ⇒ Object (readonly)
Returns the value of attribute self_data.
10 11 12 |
# File 'lib/avmtrf1/ini/profile.rb', line 10 def self_data @self_data end |
Instance Method Details
#[](key) ⇒ Object
20 21 22 |
# File 'lib/avmtrf1/ini/profile.rb', line 20 def [](key) data[key] end |
#fetch(key) ⇒ Object
24 25 26 |
# File 'lib/avmtrf1/ini/profile.rb', line 24 def fetch(key) data.fetch(key) end |
#to_h(prefix = '') ⇒ Object
28 29 30 31 |
# File 'lib/avmtrf1/ini/profile.rb', line 28 def to_h(prefix = '') data.select { |k, _v| k.start_with?(prefix) } .map { |e| [e[0].gsub(/\A#{Regexp.quote(prefix)}/, ''), e[1]] }.to_h end |