Class: Bones::Cache::Options
Instance Attribute Summary collapse
-
#base ⇒ Object
Returns the value of attribute base.
-
#destination ⇒ Object
Returns destination.
-
#noop ⇒ Object
Returns the value of attribute noop.
-
#release ⇒ Object
Returns the value of attribute release.
-
#versioned ⇒ Object
Returns the value of attribute versioned.
Class Method Summary collapse
-
.process(args) ⇒ Object
Process arguments.
Instance Method Summary collapse
- #default_destination ⇒ Object
-
#initialize ⇒ Options
constructor
A new instance of Options.
- #merge(options = {}) ⇒ Object
- #release? ⇒ Boolean
-
#versioned? ⇒ Boolean
Returns true if the versions enabled.
Constructor Details
#initialize ⇒ Options
Returns a new instance of Options.
6 7 8 9 10 11 |
# File 'lib/bones/cache.rb', line 6 def initialize super self.base = '' # Base URL is empty self.release = nil self.noop = false end |
Instance Attribute Details
#base ⇒ Object
Returns the value of attribute base.
4 5 6 |
# File 'lib/bones/cache.rb', line 4 def base @base end |
#destination ⇒ Object
Returns destination
85 86 87 |
# File 'lib/bones/cache.rb', line 85 def destination @destination end |
#noop ⇒ Object
Returns the value of attribute noop.
4 5 6 |
# File 'lib/bones/cache.rb', line 4 def noop @noop end |
#release ⇒ Object
Returns the value of attribute release.
4 5 6 |
# File 'lib/bones/cache.rb', line 4 def release @release end |
#versioned ⇒ Object
Returns the value of attribute versioned.
4 5 6 |
# File 'lib/bones/cache.rb', line 4 def versioned @versioned end |
Class Method Details
.process(args) ⇒ Object
Process arguments
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/bones/cache.rb', line 23 def self.process(args) args = [] if args.blank? = new OptionParser.new do |o| o.on('--destination PATH', '-d PATH', "Change the destination directory") do |path| .destination = path end o.on('--versioned', '--versions', "Enable versioning") do .versioned = true end o.on('--base PATH', "Change the base URL path") do |path| .base = path # Bones.base = path end o.on('--noop', "Do not write any files") do .noop = true end o.on_tail("-h", "--help", "Show this message") do puts o; exit end end.parse!(args) end |
Instance Method Details
#default_destination ⇒ Object
71 72 73 |
# File 'lib/bones/cache.rb', line 71 def default_destination File.(Bones.root / 'public') end |
#merge(options = {}) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/bones/cache.rb', line 13 def merge(={}) .each do |k, v| method = "#{k}=".to_sym send(method, v) if respond_to?(method) end self end |
#release? ⇒ Boolean
80 81 82 |
# File 'lib/bones/cache.rb', line 80 def release? !release.nil? end |
#versioned? ⇒ Boolean
Returns true if the versions enabled
76 77 78 |
# File 'lib/bones/cache.rb', line 76 def versioned? Bones::VersionedRelease === release end |