Code Monkey home page Code Monkey logo

are-we-there-yet's Introduction

nested_inherited_jruby_include_package

JRuby's include_package (mentioned in https://github.com/jruby/jruby/wiki/CallingJavaFromJRuby) includes Java packages in JRuby on const_missing. However, it does not trickle down to subclasses/submodules nor nested-classes/nested-modules.

nested_inherited_jruby_include_package patches up JRuby to add that capability.

Example (nesting):

require 'nested_inherited_jruby_include_package'

class OuterClass
  include_package java.util
  class InnerClass
    def initialize
      p Arrays.asList(1, 2, 3)
    end
  end
end

OuterClass::InnerClass.new
# prints #<Java::JavaUtil::Arrays::ArrayList:0x233fe9b6>

Example (inheritance):

require 'nested_inherited_jruby_include_package'

class SuperClass
  include_package java.util
end

class SubClass < SuperClass
  def initialize
    p Arrays.asList(1, 2, 3)
  end
end

SubClass.new
# prints #<Java::JavaUtil::Arrays::ArrayList:0x7ce3cb8e>

Example (java inheritance):

module GUI
  include_package 'javax.swing'
  include_package 'java.awt.image' # BufferedImage
  # bellow won't work without accessing BufferedImage before :
  class ShowImage < JFrame
    p BufferedImage.new(10, 20, BufferedImage::TYPE_BYTE_BINARY)
  end
end
# prints #<Java::JavaAwtImage::BufferedImage:0x2f112965>

More examples can be found in:

spec/lib/core/src/main/ruby/jruby/java/core_ext/module_spec.rb

Setup

Add the following to Gemfile:

gem 'nested_inherited_jruby_include_package', '~> 0.3.0'

And, then run:

jruby -S bundle install

If you are not using Bundler, run:

jruby -S gem install nested_inherited_jruby_include_package -v 0.3.0

Then add this line to your code:

require 'nested_inherited_jruby_include_package'

Caveats

This gem relies on Module#const_missing after it aliases it to Module#const_missing_without_nested_inherited_jruby_include_package

As such, it works optimally if your project and loaded gems do not override Module#const_missing

Implementation Note

To avoid method and constant pollution in Module, the implementation intentionally trades off code clarity for lack of pollution by not relying on methods, yet local lambdas, in modularizing logic.

Issue Reporting

This is an early alpha. It has only been used in a couple of projects. As such, there are no guarantees for its functionality. Please report any issues you might discover when using on your own projects.

Change Log

CHANGELOG.md

License

The MIT License

LICENSE.txt

Copyright

Copyright (c) 2020 Andy Maleh

are-we-there-yet's People

Contributors

andyobtiva avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

are-we-there-yet's Issues

Can't change start date or changes to the day before

Can’t change start date (or refuses a date and then later when entering a date one day later it takes it)

  • Fix issue with date falling one day before
  • Fix issue with start date refusing to change after setting both start and end date with a duration of 2 days

List Tasks

List Tasks

I would like to list tasks entered into the system, with the following fields:

  • Name of project
  • Type of task
  • Date of start
  • Duration
  • Date of completion.
  • Priority of task

Enter Task

  • DB fields
    • t.string :project_name
    • t.integer :position
    • t.string :name
    • t.string :task_type
    • t.timestamp :start_at
    • t.integer :duration
    • t.string :priority
    • t.boolean :finished, default: false
  • Initial form fields
    • Project Name
    • Name
    • Task Type
    • Start At
    • Duration
    • Priority
  • Project Name auto-remember dropdown
  • Task Type auto-remember dropdown
  • Start At Calendar Widget with auto-date guess
  • Duration Dropdown
  • Priority Dropdown
  • Validation

View Progress Chart

  • Add Nebula Gantt Chart JAR file
  • Configure Gantt Chart packages in Glimmer
  • Use gantt_chart Glimmer DSL keyword
  • Wire GanttChart widget to Tasks
  • Configure Gantt Chart Display Settings
  • Support multiple projects
  • Render project sections

Edit Task

  • Project Name (combo)
  • Task Type (combo)
  • Task Name (text)
  • Start Date (c_date_time)
  • End Date (c_date_time)
  • Duration (combo(:read_only))
  • Priority (combo(:read_only))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.