Class: VisualStudioFiles::FileReference

Inherits:
Object
  • Object
show all
Defined in:
lib/visual_studio_files.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ FileReference

Returns a new instance of FileReference.



77
78
79
80
81
# File 'lib/visual_studio_files.rb', line 77

def initialize opts
  opts.each do |key,value|
    self[key]=value
  end
end

Instance Attribute Details

#dependent_uponObject (readonly)

Returns the value of attribute dependent_upon.



76
77
78
# File 'lib/visual_studio_files.rb', line 76

def dependent_upon
  @dependent_upon
end

#downcase_and_path_replacedObject (readonly)

Returns the value of attribute downcase_and_path_replaced.



76
77
78
# File 'lib/visual_studio_files.rb', line 76

def downcase_and_path_replaced
  @downcase_and_path_replaced
end

#fileObject (readonly)

Returns the value of attribute file.



76
77
78
# File 'lib/visual_studio_files.rb', line 76

def file
  @file
end

#generatorObject (readonly)

Returns the value of attribute generator.



76
77
78
# File 'lib/visual_studio_files.rb', line 76

def generator
  @generator
end

Returns the value of attribute link.



76
77
78
# File 'lib/visual_studio_files.rb', line 76

def link
  @link
end

#sub_typeObject (readonly)

Returns the value of attribute sub_type.



76
77
78
# File 'lib/visual_studio_files.rb', line 76

def sub_type
  @sub_type
end

#typeObject (readonly)

Returns the value of attribute type.



76
77
78
# File 'lib/visual_studio_files.rb', line 76

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object Also known as: eql?



85
86
87
# File 'lib/visual_studio_files.rb', line 85

def ==(other)
  other.downcase_and_path_replaced == @downcase_and_path_replaced
end

#[]=(idx, value) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/visual_studio_files.rb', line 88

def []=(idx,value)
  case idx
  when :file
    @file = value
  when :type
    @type = value
  when :link
    @link = value
  when :dependent_upon
    @dependent_upon = value
  when :sub_type
    @sub_type = value
  when :generator
    @generator = value
  end
end

#compile?Boolean

Returns:

  • (Boolean)


110
111
112
# File 'lib/visual_studio_files.rb', line 110

def compile?
  @type=="Compile"
end

#content?Boolean

Returns:

  • (Boolean)


113
114
115
# File 'lib/visual_studio_files.rb', line 113

def content?
  @type=="Content"
end

#embedded_resource?Boolean

Returns:

  • (Boolean)


116
117
118
# File 'lib/visual_studio_files.rb', line 116

def embedded_resource?
  @type=="EmbeddedResource"
end

#hashObject



123
124
125
# File 'lib/visual_studio_files.rb', line 123

def hash
  @downcase_and_path_replaced.hash
end

#link?Boolean

Returns:

  • (Boolean)


104
105
106
# File 'lib/visual_studio_files.rb', line 104

def link?
  @link!=nil && !@link.empty?
end

#none?Boolean

Returns:

  • (Boolean)


107
108
109
# File 'lib/visual_studio_files.rb', line 107

def none?
  @type=="None"
end

#page?Boolean

Returns:

  • (Boolean)


119
120
121
# File 'lib/visual_studio_files.rb', line 119

def page?
  @type=="Page"
end

#to_hashObject



126
127
128
129
130
131
132
133
134
135
# File 'lib/visual_studio_files.rb', line 126

def to_hash
  return {
    :file=>@file,
    :type=>@type,
    :link=>@link,
    :dependent_upon=>@dependent_upon,
    :sub_type=>@sub_type,
    :generator=>@generator
  }
end

#to_sObject



136
137
138
# File 'lib/visual_studio_files.rb', line 136

def to_s
  "#{@file} #{@type} #{@link}"
end