Sha256: ad51ab8f5648b8b08522f1314839d814306242b305e65765bbc0ca81cead9fa8

Contents?: true

Size: 657 Bytes

Versions: 3

Compression:

Stored size: 657 Bytes

Contents

class ObjcStep < Step
  def first_part
    body.gsub(/\s+/,"_").gsub(/'[^']*'/, "__").remove_invalid_chars
  end
  
  def args_string
    if has_args?
      ([":@\"#{args[0]}\""] + 
      (args[1..args.length] || []).map { |a| "arg:@\"#{a}\"" }).join(" ")
    else
      ""
    end
  end
  
  def to_s
    "[self #{message}];"
  end
  
  def parameter_string
    if has_args?
      s = ":(NSString *)arg "
      (args[1..args.length] || []).each_with_index do |a, i|
        s << "arg:(NSString *)arg#{i+2} "
      end
      s
    else
      ""
    end
  end
  
  def to_ocmethod
    <<-END
-(void) #{first_part + parameter_string}
{
  
}
    END
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
features-0.3.0 lib/ObjC/objc_step.rb
features-0.2.1 lib/ObjC/objc_step.rb
features-0.2.0 lib/ObjC/objc_step.rb