Class: FileRef
- Inherits:
-
Object
- Object
- FileRef
- Defined in:
- lib/unigunkan/fileref.rb
Instance Attribute Summary collapse
-
#file_encoding ⇒ Object
Returns the value of attribute file_encoding.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_known_type ⇒ Object
Returns the value of attribute last_known_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#source_tree ⇒ Object
Returns the value of attribute source_tree.
Class Method Summary collapse
Instance Method Summary collapse
- #build_file ⇒ Object
- #fields ⇒ Object
- #group ⇒ Object
-
#initialize(hash) ⇒ FileRef
constructor
A new instance of FileRef.
- #key ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(hash) ⇒ FileRef
Returns a new instance of FileRef.
4 5 6 7 8 9 10 11 |
# File 'lib/unigunkan/fileref.rb', line 4 def initialize(hash) @id = SecureRandom.hex(12) @name = hash[:name] @last_known_type = hash[:last_known_type] @path = hash[:path] @source_tree = hash[:source_tree] @file_encoding = hash[:file_encoding] end |
Instance Attribute Details
#file_encoding ⇒ Object
Returns the value of attribute file_encoding.
2 3 4 |
# File 'lib/unigunkan/fileref.rb', line 2 def file_encoding @file_encoding end |
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'lib/unigunkan/fileref.rb', line 2 def id @id end |
#last_known_type ⇒ Object
Returns the value of attribute last_known_type.
2 3 4 |
# File 'lib/unigunkan/fileref.rb', line 2 def last_known_type @last_known_type end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/unigunkan/fileref.rb', line 2 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
2 3 4 |
# File 'lib/unigunkan/fileref.rb', line 2 def path @path end |
#source_tree ⇒ Object
Returns the value of attribute source_tree.
2 3 4 |
# File 'lib/unigunkan/fileref.rb', line 2 def source_tree @source_tree end |
Class Method Details
.file_group(filename) ⇒ Object
39 40 41 42 43 44 45 |
# File 'lib/unigunkan/fileref.rb', line 39 def self.file_group(filename) ext = filename.split(".").last case ext when "dylib" return "Frameworks" end end |
Instance Method Details
#build_file ⇒ Object
34 35 36 37 |
# File 'lib/unigunkan/fileref.rb', line 34 def build_file @build_file = BuildFile.new(self) if !@build_file return @build_file end |
#fields ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/unigunkan/fileref.rb', line 13 def fields last_known_type = @last_known_type last_known_type = "\"#{last_known_type}\"" if last_known_type == "compiled.mach-o.dylib" elements = ["isa = PBXFileReference", "lastKnownType = #{last_known_type}", "name = #{@name}", "path = #{@path}", "sourceTree = #{@source_tree}"] elements << "fileEncoding = #{@file_encoding}" if @file_encoding elements.map{|a| "#{a};"}.join(" ") end |
#group ⇒ Object
30 31 32 |
# File 'lib/unigunkan/fileref.rb', line 30 def group FileRef.file_group(self.name) end |
#key ⇒ Object
22 23 24 |
# File 'lib/unigunkan/fileref.rb', line 22 def key "#{@id} /* #{@name} */" end |
#to_s ⇒ Object
26 27 28 |
# File 'lib/unigunkan/fileref.rb', line 26 def to_s "#{self.key} = {#{self.fields}};" end |