melt 0.1 → 0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 46b89c2672adf183efc87c01bb21872138656bfc
4
- data.tar.gz: 861118faeb07a92a47cb9d19b6bef00d0498f470
3
+ metadata.gz: 68089896ba58f1f0a0eeb80c97baf1983f6a40e6
4
+ data.tar.gz: aaa92be1d91097227bd85ec14839bef00f4b9129
5
5
  SHA512:
6
- metadata.gz: 2b90920fb02d99fbb2cd41dfbd383091bcc7cd27e0a61f6163bf4487ead91f0acb1bcb7ed3a7f6de2e19135889b7040329de0eb66adde021dac7f308d14ed912
7
- data.tar.gz: 02731b394863fd85fcac7327e083793f81f7371b0c72423ba8309b97c6d3f31bfcfae247972b3a86fb103a794dab2332f7e0b9a1721cdff092a33fc66dedb918
6
+ metadata.gz: 82fa7b5f71f0ae69703829f60adea59a7f2661ae8805c637d295f81b4db3e53c68afc4e63ee240f71c4a9f74e131131fa234fcb0925a072505df3f4fe02a56bc
7
+ data.tar.gz: 75796e3b6ef3704d392c4c7273cfcb217d9fe31d8c7a7cd70d1e3a25187bfe1cd8d009ad7fa161c108094ca4bae2f6f16e7b9b3ed4bded1e4ffaa1cc673db181
@@ -0,0 +1,46 @@
1
+ package org.zizkovrb.melt;
2
+
3
+ import java.io.IOException;
4
+
5
+ import org.jruby.Ruby;
6
+ import org.jruby.RubyClass;
7
+ import org.jruby.RubyModule;
8
+ import org.jruby.RubyObject;
9
+ import org.jruby.anno.JRubyMethod;
10
+ import org.jruby.runtime.ObjectAllocator;
11
+ import org.jruby.runtime.ThreadContext;
12
+ import org.jruby.runtime.builtin.IRubyObject;
13
+ import org.jruby.runtime.load.BasicLibraryService;
14
+
15
+ public class MeltService implements BasicLibraryService {
16
+ private Ruby runtime;
17
+
18
+ public boolean basicLoad(Ruby runtime) throws IOException {
19
+ this.runtime = runtime;
20
+ RubyModule melt = runtime.defineModule("Melt");
21
+
22
+ RubyClass down = melt.defineClassUnder("Down", runtime.getObject(), new ObjectAllocator() {
23
+ public IRubyObject allocate(Ruby runtime, RubyClass rubyClass) {
24
+ return new MeltDown(runtime, rubyClass);
25
+ }
26
+
27
+ });
28
+
29
+ down.defineAnnotatedMethods(MeltDown.class);
30
+ return true;
31
+ }
32
+
33
+ public class MeltDown extends RubyObject {
34
+ public MeltDown(final Ruby runtime, RubyClass rubyClass) {
35
+ super(runtime, rubyClass);
36
+ }
37
+
38
+ @JRubyMethod
39
+ public IRubyObject execute(ThreadContext context, IRubyObject target) {
40
+ if(target.isFrozen()) {
41
+ target.setFrozen(false);
42
+ }
43
+ return target;
44
+ }
45
+ }
46
+ }
@@ -1 +1,11 @@
1
1
  require "melt/melt"
2
+
3
+ if RUBY_PLATFORM =~ /java/
4
+ class Object
5
+ def melt
6
+ require 'jruby'
7
+ org.zizkovrb.melt.MeltService.new.basicLoad(JRuby.runtime)
8
+ Melt::Down.new.execute(self)
9
+ end
10
+ end
11
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: melt
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Šimánek
8
8
  autorequire:
9
- bindir: exe
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-22 00:00:00.000000000 Z
11
+ date: 2015-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -74,17 +74,10 @@ extensions:
74
74
  - ext/melt/extconf.rb
75
75
  extra_rdoc_files: []
76
76
  files:
77
- - ".gitignore"
78
- - ".travis.yml"
79
- - Gemfile
80
- - LICENSE.txt
81
- - README.md
82
- - Rakefile
77
+ - ext/melt/MeltService.java
83
78
  - ext/melt/extconf.rb
84
79
  - ext/melt/melt.c
85
- - ext/melt/melt.h
86
80
  - lib/melt.rb
87
- - melt.gemspec
88
81
  homepage: https://github.com/zizkovrb/melt
89
82
  licenses:
90
83
  - MIT
data/.gitignore DELETED
@@ -1,14 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- *.bundle
11
- *.so
12
- *.o
13
- *.a
14
- mkmf.log
@@ -1,3 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.2.0
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in melt.gemspec
4
- gemspec
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2015 Josef Šimánek
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/README.md DELETED
@@ -1,45 +0,0 @@
1
- # Melt [![Build Status](https://travis-ci.org/zizkovrb/melt.svg?branch=master)](https://travis-ci.org/zizkovrb/melt)
2
-
3
- [There is no way to unfreeze a frozen object.](http://ruby-doc.org/core-2.2.0/Object.html#method-i-freeze) Really? Have you ever heard about icebergs or icicles? What about melting?
4
-
5
- ![no way to unfreeze?](http://media.giphy.com/media/Et9WoN2Aejm3C/giphy.gif)
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'melt'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install melt
22
-
23
- ## Usage
24
-
25
- ```ruby
26
- require 'melt'
27
-
28
- icicle = "----->"
29
-
30
- # winter
31
- icicle.freeze
32
- icicle.frozen? #=> true
33
-
34
- # spring
35
- icicle.melt
36
- icicle.frozen? #=> false
37
- ```
38
-
39
- ## Contributing
40
-
41
- 1. Fork it ( https://github.com/zizkovrb/melt/fork )
42
- 2. Create your feature branch (`git checkout -b my-new-feature`)
43
- 3. Commit your changes (`git commit -am 'Add some feature'`)
44
- 4. Push to the branch (`git push origin my-new-feature`)
45
- 5. Create a new Pull Request
data/Rakefile DELETED
@@ -1,16 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
3
-
4
- Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- end
7
-
8
- task :default => [:clean, :build, :test]
9
-
10
- require "rake/extensiontask"
11
-
12
- task :build => :compile
13
-
14
- Rake::ExtensionTask.new("melt") do |ext|
15
- ext.lib_dir = "lib/melt"
16
- end
@@ -1,8 +0,0 @@
1
- #ifndef MELT_H
2
- #define MELT_H 1
3
-
4
- #include "ruby.h"
5
-
6
- VALUE melt(VALUE self);
7
-
8
- #endif /* MELT_H */
@@ -1,30 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- Gem::Specification.new do |spec|
6
- spec.name = "melt"
7
- spec.version = "0.1"
8
- spec.authors = ["Josef Šimánek"]
9
- spec.email = ["josef.simanek@gmail.com"]
10
-
11
- if spec.respond_to?(:metadata)
12
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
13
- end
14
-
15
- spec.summary = %q{There is no way to unfreeze a frozen object. Really?}
16
- spec.description = %q{Have you ever heard about icebergs or icicles? What about melting?}
17
- spec.homepage = "https://github.com/zizkovrb/melt"
18
- spec.license = "MIT"
19
-
20
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
21
- spec.bindir = "exe"
22
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
- spec.require_paths = ["lib"]
24
- spec.extensions = ["ext/melt/extconf.rb"]
25
-
26
- spec.add_development_dependency "bundler", "~> 1.7"
27
- spec.add_development_dependency "rake", "~> 10.0"
28
- spec.add_development_dependency "rake-compiler"
29
- spec.add_development_dependency "minitest"
30
- end