NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| id | schedule_id | start_datetime | end_datetime | deleted_at | created_at | |
|---|---|---|---|---|---|---|
| 1 | 1 | 2018–01–12 08:00:00 | 2018–01–12 09:00:00 | 2018–01–11 00:00:00 | ||
| 1 | 1 | 2018–01–12 08:00:00 | 2018–01–12 09:00:00 | 2018–01–11 00:00:00 |
| class ComputerDumberClass | |
| def initialize(computer_id, data_source) | |
| @id = computer_id | |
| @data_source = data_source | |
| end | |
| def mouse | |
| info = @data_source.get_mouse_info(@id) | |
| price = @data_source.get_mouse_price(@id) | |
| result = "Mouse: #{info} ($#{price})" |
| # Monkeypatch | |
| # original object class | |
| class ObjectModel | |
| def to_alphanumeric(s) | |
| s.gsub(/[^\w\s]/, '') | |
| end | |
| end | |
| # monkey patch in string class | |
| class String |
| class Klass | |
| def initialize(method_name) | |
| @method_name = method_name | |
| end | |
| def self.this_is_my_name | |
| puts self | |
| end | |
| def this_is_my_name |
NOTE: This post now lives (and kept up to date) on my blog: http://hakunin.com/rails3-load-paths
Do nothing. All files in this dir are eager loaded in production and lazy loaded in development by default.
| class Node | |
| attr_accessor :value, :left_node, :right_node | |
| def initialize(value,l=nil,r=nil) | |
| @value = value | |
| @left_node = l | |
| @right_node = r | |
| end | |
| def has_child? | |
| return !@left_node.nil? && !@right_node.nil? | |
| end |