Class: Pod::Generator::DummySource

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/generator/dummy_source.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(class_name_identifier) ⇒ DummySource

Returns a new instance of DummySource.



6
7
8
9
# File 'lib/cocoapods/generator/dummy_source.rb', line 6

def initialize(class_name_identifier)
  validated_class_name_identifier = class_name_identifier.gsub(/[^0-9a-z_]/i, '_')
  @class_name = "PodsDummy_#{validated_class_name_identifier}"
end

Instance Attribute Details

#class_nameObject (readonly)

Returns the value of attribute class_name.



4
5
6
# File 'lib/cocoapods/generator/dummy_source.rb', line 4

def class_name
  @class_name
end

Instance Method Details

#save_as(pathname) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/cocoapods/generator/dummy_source.rb', line 11

def save_as(pathname)
  pathname.open('w') do |source|
    source.puts '#import <Foundation/Foundation.h>'
    source.puts "@interface #{class_name} : NSObject"
    source.puts '@end'
    source.puts "@implementation #{class_name}"
    source.puts '@end'
  end
end