Class: HMap::HMapHeaderEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/hmap/helper/hmap_helper.rb

Overview

HMap file information

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ HMapHeaderEntry

Returns a new instance of HMapHeaderEntry.



10
11
12
13
# File 'lib/hmap/helper/hmap_helper.rb', line 10

def initialize(type)
  @type = type
  @headers = []
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



8
9
10
# File 'lib/hmap/helper/hmap_helper.rb', line 8

def headers
  @headers
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/hmap/helper/hmap_helper.rb', line 8

def type
  @type
end

Instance Method Details

#add_header(header) ⇒ Object



15
16
17
# File 'lib/hmap/helper/hmap_helper.rb', line 15

def add_header(header)
  headers << header
end

#build_setting(path, name) ⇒ Object



35
36
37
38
39
40
# File 'lib/hmap/helper/hmap_helper.rb', line 35

def build_setting(path, name)
  full_path = File.join(path, file_name(name))
  build_setting_key do |key|
    [key, "\"#{full_path}\""]
  end
end

#build_setting_keyObject



24
25
26
27
28
29
30
31
32
33
# File 'lib/hmap/helper/hmap_helper.rb', line 24

def build_setting_key
  case type
  when :i_headers, :iextra_headers
    yield('-I', :HEADER_SEARCH_PATHS) if block_given?
  when :iquote_headers, :extra_headers
    yield('-iquote', :USER_HEADER_SEARCH_PATHS) if block_given?
  else
    raise Informative, "Error: header type not expect#{type}"
  end
end

#build_setting_xcconfig(path, name) ⇒ Object



42
43
44
45
46
47
# File 'lib/hmap/helper/hmap_helper.rb', line 42

def build_setting_xcconfig(path, name)
  full_path = File.join(path, file_name(name))
  build_setting_key do |_, xc|
    [xc, "\"#{full_path}\""]
  end
end

#file_name(name) ⇒ Object



19
20
21
22
# File 'lib/hmap/helper/hmap_helper.rb', line 19

def file_name(name)
  name = 'hmap' if name.nil?
  [name, '-', type, '.hmap'].join
end