Last active
May 28, 2019 00:24
-
-
Save wstucco/42392ee21b76dfa3ef83 to your computer and use it in GitHub Desktop.
Opal Meteor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if Meteor.client? | |
user = User.new('Admin') | |
puts user | |
puts user.admin? | |
puts "hello from client #{user.name}!" | |
end | |
if Meteor.server? | |
user = User.new('Massimo') | |
puts user | |
puts user.admin? | |
puts "hello from server #{user.name}!" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Meteor | |
def self.server? | |
`Meteor.isServer` | |
end | |
def self.client? | |
`Meteor.isClient` | |
end | |
def self.cordova? | |
`Meteor.isCordova` | |
end | |
def self.startup(&block) | |
`#{block.call if block_given?}` | |
end | |
def self.wrap_async(func, context = nil) | |
`Meteor.wrapAsync(#{func.to_n}, #{context.to_n})` if context | |
`Meteor.wrapAsync(#{func.to_n})` unless context | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User | |
attr_accessor :name | |
def initialize(name) | |
@name = name | |
end | |
def admin? | |
@name == 'Admin' | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment