Skip to content

Commit

Permalink
Make corelib more customizable by adding requires for dependant files
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Jan 7, 2014
1 parent f753d31 commit 4f7f1ca
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions opal/corelib/array.rb
@@ -1,3 +1,5 @@
require 'corelib/enumerable'

class Array
include Enumerable

Expand Down
2 changes: 2 additions & 0 deletions opal/corelib/class.rb
@@ -1,3 +1,5 @@
require 'corelib/module'

class Class
def self.new(sup = Object, &block)
%x{
Expand Down
2 changes: 2 additions & 0 deletions opal/corelib/encoding.rb
@@ -1,3 +1,5 @@
require 'corelib/string'

class Encoding
def self.register(name, options = {}, &block)
names = [name] + (options[:aliases] || [])
Expand Down
2 changes: 2 additions & 0 deletions opal/corelib/enumerator.rb
@@ -1,3 +1,5 @@
require 'corelib/enumerable'

class Enumerator
include Enumerable

Expand Down
2 changes: 2 additions & 0 deletions opal/corelib/hash.rb
@@ -1,3 +1,5 @@
require 'corelib/enumerable'

class Hash
include Enumerable

Expand Down
2 changes: 2 additions & 0 deletions opal/corelib/numeric.rb
@@ -1,3 +1,5 @@
require 'corelib/comparable'

class Numeric
include Comparable

Expand Down
2 changes: 2 additions & 0 deletions opal/corelib/range.rb
@@ -1,3 +1,5 @@
require 'corelib/enumerable'

class Range
include Enumerable

Expand Down
2 changes: 2 additions & 0 deletions opal/corelib/string.rb
@@ -1,3 +1,5 @@
require 'corelib/comparable'

class String
include Comparable

Expand Down
2 changes: 2 additions & 0 deletions opal/corelib/time.rb
@@ -1,3 +1,5 @@
require 'corelib/comparable'

class Time
include Comparable

Expand Down

7 comments on commit 4f7f1ca

@elia
Copy link
Member

@elia elia commented on 4f7f1ca Jan 7, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 is mopal on its way? :)

@adambeynon
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep 😄 been using some hardcoded mopal/mini-opal files in a site coming up. Just trying to work out now which files belong in mopal, and which ones could be optional..

@ryanstout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is the idea that you could only require parts of corelib?

@adambeynon
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ryanstout yep! I also want to add a mopal.rb file into corelib, so you can require that instead of opal and get this cut down lib. All the core files are still requirable, so you can mix and match as you like. e.g. if you don't want Struct, then just dont require it.

@ryanstout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So mopal would be the corelib's required to make the super basics work, but then you would require in other things you needed, Struct, Time, etc...?

@adambeynon
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep. Off the top of my head, mopal would include array, hash, string, numeric, proc, enumerable and class/module. It is fair to say that a lot of apps/projects would need more than that, but mopal is just a simple way to get a really small runtime to do the very basic ruby. Aimed at websites rather than webapps I guess.

@ryanstout
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a great idea.

Please sign in to comment.