buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Antoine Toulme (JIRA)" <j...@apache.org>
Subject [jira] Commented: (BUILDR-184) when creating a sub project, extend it with the parent's methods
Date Sun, 28 Feb 2010 08:37:05 GMT

    [ https://issues.apache.org/jira/browse/BUILDR-184?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12839386#action_12839386
] 

Antoine Toulme commented on BUILDR-184:
---------------------------------------

Better use the flexibility and power of Ruby: define whatever changes you want to make to
the project in a separate module, and then extend the project with it:


module IdRedefinition

  def id
   ...
  end
end

define 'foo' do
  extend IdRedefinition
  define 'sub' do
    extend IdRedefinition
  end
  define 'bar' do
  end
end

See that bar this way isn't using this special id method.

If you'd like all projects in the file to use the module, then you can use the Extension mechanism
and include it in Project.



> when creating a sub project, extend it with the parent's methods
> ----------------------------------------------------------------
>
>                 Key: BUILDR-184
>                 URL: https://issues.apache.org/jira/browse/BUILDR-184
>             Project: Buildr
>          Issue Type: Wish
>    Affects Versions: 1.3.2
>            Reporter: Ittay Dror
>
> sometimes it is required to override methods in Project. my use case is that I'd like
to override 'id' from package
> i think it would be nice if i could do:
> define 'base'
>    def id 
>       ...
>    end
>    define 'sub'
>    end
> end
> so that 'sub' inherits the redifinition of id.
> it will also have benefits for utility methods since it means i can just call it directly,
not through 'parent' (or parent.parent in case of more level of nesting)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message