Recent comments


Syndicate


Follow Me

Twitter Facebook

Modules

Drupal module development - permissions

As promised, after my Python bragging we're going to resume and wrap-up everything on our dfacebox module. If you still remember, our test page is accessible to anonymous users (users that are not registered). You don't normally exposed module settings or test pages like this so instead, we're going to apply some restriction so only those that have permission to access it will be able to view except for the root account which pretty much can do everything.

Ruby Mixins

I've been playing around with Ruby's mixins today and It's really fun. Here's a snippet:

 

module Greeter
  
  def who_am_i?
    "#{self.class.name}"
  end

  def greet
    puts "Hello #{@name}"
  end
  
end

class Student
  
  def initialize(n)
    @name = n
  end
  
  include Greeter
end

class Teacher
  
  def initialize(n)
    @name = n
  end
  
  include Greeter
end

 

Now fire up irb and do this: