Class: Referee::Storyboard

Inherits:
Renderable show all
Defined in:
lib/referee/renderables/storyboard.rb

Overview

Renderable implementation for UIStoryboards in a project.

Instance Attribute Summary collapse

Attributes inherited from Renderable

#swift_type, #type

Instance Method Summary collapse

Methods inherited from Renderable

#bundle_accessor, #methodize_name, #simple_method_declaration, #simple_method_implementation, #simple_swift_method, #simple_swift_string_case, #swift_bundle_accessor

Constructor Details

#initialize(name, config) ⇒ Storyboard

Returns a new instance of Storyboard.



6
7
8
9
10
11
# File 'lib/referee/renderables/storyboard.rb', line 6

def initialize(name, config)
  @name = name
  @type = 'UIStoryboard *'
  @swift_type = 'UIStoryboard'
  @config = config
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



4
5
6
# File 'lib/referee/renderables/storyboard.rb', line 4

def config
  @config
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/referee/renderables/storyboard.rb', line 4

def name
  @name
end

Instance Method Details

#declarationObject



13
14
15
# File 'lib/referee/renderables/storyboard.rb', line 13

def declaration
  simple_method_declaration @name
end

#implementationObject



17
18
19
20
21
# File 'lib/referee/renderables/storyboard.rb', line 17

def implementation
  bundle = bundle_accessor(@config.bundle_id)
  body = "[UIStoryboard storyboardWithName:@\"#{@name}\" bundle:#{bundle}]"
  simple_method_implementation @name, body
end

#swift_implementationObject



23
24
25
26
27
# File 'lib/referee/renderables/storyboard.rb', line 23

def swift_implementation
  bundle = swift_bundle_accessor(@config.bundle_id)
  body = "UIStoryboard(name: \"#{@name}\", bundle: #{bundle})"
  simple_swift_method @name, body
end