Displaying 8 results from an estimated 8 matches for "module_funct".
Did you mean:
  module_func
  
2013 Aug 29
2
Need a bit help on "module_function" method
The documentation is very straight forward and the mentioned example
also cleared all the lines except the one mentioned inside **.
http://ruby-doc.org/core-2.0.0/Module.html#method-i-module_function
Creates module functions for the named methods. These functions may be
called with the module as a receiver, and also become available as
instance methods to classes that mix in the module. Module functions are
copies of the original, and so may be changed independently. The
instance-method ver...
2013 Feb 03
4
Create a helper for models and views?
Hi!
If I have a method that is useful in both models and in views, where would 
be the appropriate place to put it?
The method in question just takes two dates as strings, tries to parse them 
and returns all dates in the range between them. It also takes care of the 
issues when the dates are badly formatted etc etc..
This method is being used in several models (so a simple class method in 
2011 Mar 03
1
Does RSpec interfere with Pathname#dirname or Pathname#realpath ?
...ch describes this code:
class B3
  module Bdd
    module Helpers
      def rvm_local_install?
        puts ENV[''rvm_path'']
        rvm_path = Pathname.new(ENV[''rvm_path''] || ''~/.rvm'')
        rvm_path.dirname.realpath.directory?
      end
      module_function :rvm_local_install?
    end
  end
end
I get this error:
https://gist.github.com/853798
irb version:
$ irb
ruby-1.9.2-p136 :001 > require ''pathname'';
ruby-1.9.2-p136 :002 >
Dir.chdir(''/home/hedge/Documents/Workspaces/b3/spec/b3/'') do
ruby-1.9.2-p136...
2010 Jan 16
0
Extending instance-methods of an Module for Plugin-Development
...odules?
The methods in a module may be instance methods or module methods. Instance
methods appear as methods in a class when the module is included, module
methods do not. Conversely, module methods may be called without creating an
encapsulating object, while instance methods may not. (See
Module#module_function)
The method which i wan''t to alias in this case is a method which is listed,
when i call:
puts Facebooker::Rails::Helpers.instance_methods
And it''s not listed, when i call:
puts Facebooker::Rails::Helpers.methods
2. What I wanna do?
I wan''t to extend facebooker...
2005 May 04
0
New win32-dir
...HGetFolderPath.call(0, const, 0, 1, path)
      else
         result = SHGetSpecialFolderPath.call(0, path, const, 0)
      end
         
      if result != 0
         path = nil
      else 
         path.gsub!(/\000/, '''')
         path.strip!
      end
      
      path
   end
   module_function :cget
end
class Dir
   include Win32
   undef_method :cget # Not meant to be public
   
   DESKTOP     = Win32.cget(CSIDL_DESKTOP)
   INTERNET    = Win32.cget(CSIDL_INTERNET)
   PROGRAMS    = Win32.cget(CSIDL_PROGRAMS)
   CONTROLS    = Win32.cget(CSIDL_CONTROLS)
   PRINTERS    = Win32.cget(CSID...
2010 Apr 19
10
Overview of Ruby 1.9 encoding problem tickets
SUMMARY:
--------
I tried to identify the general and root causes for these problems
with 1.9, by taking into account non-utf encoding, current patches,
comments and ideas. I used ticket #2188 as base for explanations.
This is a long read. I wanted to include all the relevant information
in one place. I also included information about related tickets in LH
and their status. I decided that adding
2005 Apr 21
9
Screen capture, save to file
...ong GetDIBits(HDC, HBITMAP, long, long, void*, void*, long)"
  extern "long GlobalUnlock(void*)"
  extern "long GlobalFree(void*)"
  extern "long DeleteObject(unsigned long)"
  extern "long DeleteDC(HDC)"
  extern "long ReleaseDC(long, HDC)"
  module_function
  def screenCapture(filename = "tmp.bmp")
    hScreenDC = getWindowDC(0)
    hmemDC = createCompatibleDC(hScreenDC)
    screenWidth = getDeviceCaps(hScreenDC, HORZRES)
    screenHeight = getDeviceCaps(hScreenDC, VERTRES)
    hmemBM = createCompatibleBitmap(hScreenDC, screenWidth,
scree...
2006 Jan 15
15
Gettext and Rails ?
Hello,
I''m trying to use ruby-gettext 1.1.1 (installed with gem) with rails and 
here is all I get :
undefined method `init_gettext'' for ApplicationController:Class
Here is my source :
require ''gettext/rails''
class ApplicationController < ActionController::Base
	init_gettext "test"
end
As a Nuby, I don''t really know what to do.