Class: LiveReload::Config
Overview
note that host and port options do not make sense in per-project config files
Instance Attribute Summary collapse
-
#apply_css_live ⇒ Object
Returns the value of attribute apply_css_live.
-
#apply_js_live ⇒ Object
Returns the value of attribute apply_js_live.
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#exclusions ⇒ Object
Returns the value of attribute exclusions.
-
#exts ⇒ Object
Returns the value of attribute exts.
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(&block) ⇒ Config
constructor
A new instance of Config.
- #merge!(other) ⇒ Object
- #update! {|_self| ... } ⇒ Object
Constructor Details
#initialize(&block) ⇒ Config
Returns a new instance of Config.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/livereload.rb', line 49 def initialize &block @host = nil @port = nil @debug = nil @exts = [] @exclusions = [] @apply_js_live = nil @apply_css_live = nil update!(&block) if block end |
Instance Attribute Details
#apply_css_live ⇒ Object
Returns the value of attribute apply_css_live.
47 48 49 |
# File 'lib/livereload.rb', line 47 def apply_css_live @apply_css_live end |
#apply_js_live ⇒ Object
Returns the value of attribute apply_js_live.
47 48 49 |
# File 'lib/livereload.rb', line 47 def apply_js_live @apply_js_live end |
#debug ⇒ Object
Returns the value of attribute debug.
47 48 49 |
# File 'lib/livereload.rb', line 47 def debug @debug end |
#exclusions ⇒ Object
Returns the value of attribute exclusions.
47 48 49 |
# File 'lib/livereload.rb', line 47 def exclusions @exclusions end |
#exts ⇒ Object
Returns the value of attribute exts.
47 48 49 |
# File 'lib/livereload.rb', line 47 def exts @exts end |
#host ⇒ Object
Returns the value of attribute host.
47 48 49 |
# File 'lib/livereload.rb', line 47 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
47 48 49 |
# File 'lib/livereload.rb', line 47 def port @port end |
Class Method Details
.load_from(file) ⇒ Object
81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/livereload.rb', line 81 def load_from file Config.new do |config| if File.file? file Object.send(:instance_variable_set, '@livereload_config', config) Object.send(:alias_method, :method_missing_without_livereload, :method_missing) Object.send(:alias_method, :method_missing, :method_missing_with_livereload) load file, true Object.send(:alias_method, :method_missing, :method_missing_without_livereload) Object.send(:instance_variable_set, '@livereload_config', nil) end end end |
Instance Method Details
#merge!(other) ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/livereload.rb', line 68 def merge! other @host = other.host if other.host @port = other.port if other.port @exts += other.exts @exclusions = other.exclusions + @exclusions @debug = other.debug if other.debug != nil @apply_js_live = other.apply_js_live if other.apply_js_live != nil @apply_css_live = other.apply_css_live if other.apply_css_live != nil self end |
#update! {|_self| ... } ⇒ Object
61 62 63 64 65 66 |
# File 'lib/livereload.rb', line 61 def update! yield self # remove leading dots @exts = @exts.collect { |e| e.sub(/^\./, '') } end |