Class: Avmtrf1::Ini::Profile

Inherits:
Object
  • Object
show all
Includes:
EacRubyUtils::SimpleCache
Defined in:
lib/avmtrf1/ini/profile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ini, name, parent_name, self_data) ⇒ Profile

Returns a new instance of Profile.

Parameters:

  • profiles (Avmtrf1::Ini::Profiles)

    rofiles [Avmtrf1::Ini::Profiles


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

#iniObject (readonly)

Returns the value of attribute ini.


10
11
12
# File 'lib/avmtrf1/ini/profile.rb', line 10

def ini
  @ini
end

#nameObject (readonly)

Returns the value of attribute name.


10
11
12
# File 'lib/avmtrf1/ini/profile.rb', line 10

def name
  @name
end

#parent_nameObject (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_dataObject (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