class Spectra::ObjcCategory
Attributes
is_header[RW]
Public Class Methods
from_attributes(attributes)
click to toggle source
# File lib/spectra/views/objc_category.rb, line 10 def self.from_attributes(attributes) [ self.new(attributes.merge(is_header: true)), self.new(attributes) ] end
new(attributes)
click to toggle source
Calls superclass method
# File lib/spectra/views/objc_category.rb, line 14 def initialize(attributes) super self.is_header = attributes[:is_header] end
Public Instance Methods
class_prefix()
click to toggle source
Templating
# File lib/spectra/views/objc_category.rb, line 23 def class_prefix self.prefix.upcase end
file_extension()
click to toggle source
# File lib/spectra/views/objc_category.rb, line 31 def file_extension self.is_header ? 'h' : 'm' end
file_keyword()
click to toggle source
# File lib/spectra/views/objc_category.rb, line 27 def file_keyword self.is_header ? "interface" : "implementation" end
filename()
click to toggle source
Pathing Hooks
Calls superclass method
# File lib/spectra/views/objc_category.rb, line 55 def filename super || "UIColor+#{self.class_prefix}Color.#{self.file_extension}" end
format_color_value(value)
click to toggle source
Formatting
# File lib/spectra/views/objc_category.rb, line 43 def format_color_value(value) '%.2f' % (value || 0.0) + 'f' end
renamer()
click to toggle source
# File lib/spectra/views/objc_category.rb, line 47 def renamer @renamer ||= lambda { |color, prefix| "#{prefix}_#{color.name.camelize(false)}Color#{color.suffix}" } end
whitespace()
click to toggle source
# File lib/spectra/views/objc_category.rb, line 35 def whitespace self.is_header ? "\n" : '' end