Class: Guillotine::Service::Options
- Inherits:
-
Struct
- Object
- Struct
- Guillotine::Service::Options
- Defined in:
- lib/guillotine/service.rb
Overview
length - Optional Integer maximum length of the short code desired. charset - Optional Array of String characters which will be present in
short code. eg. ['a', 'b', 'c', 'd', 'e', 'f']
Instance Attribute Summary collapse
-
#charset ⇒ Object
Returns the value of attribute charset.
-
#default_url ⇒ Object
Returns the value of attribute default_url.
-
#length ⇒ Object
Returns the value of attribute length.
-
#required_host ⇒ Object
Returns the value of attribute required_host.
-
#strip_anchor ⇒ Object
Returns the value of attribute strip_anchor.
-
#strip_query ⇒ Object
Returns the value of attribute strip_query.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#charset ⇒ Object
Returns the value of attribute charset
9 10 11 |
# File 'lib/guillotine/service.rb', line 9 def charset @charset end |
#default_url ⇒ Object
Returns the value of attribute default_url
9 10 11 |
# File 'lib/guillotine/service.rb', line 9 def default_url @default_url end |
#length ⇒ Object
Returns the value of attribute length
9 10 11 |
# File 'lib/guillotine/service.rb', line 9 def length @length end |
#required_host ⇒ Object
Returns the value of attribute required_host
9 10 11 |
# File 'lib/guillotine/service.rb', line 9 def required_host @required_host end |
#strip_anchor ⇒ Object
Returns the value of attribute strip_anchor
9 10 11 |
# File 'lib/guillotine/service.rb', line 9 def strip_anchor @strip_anchor end |
#strip_query ⇒ Object
Returns the value of attribute strip_query
9 10 11 |
# File 'lib/guillotine/service.rb', line 9 def strip_query @strip_query end |
Class Method Details
.from(value) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/guillotine/service.rb', line 11 def self.from(value) case value when nil, "" then new when String, Regexp then new(value) when Hash then opt = new value.each do |key, value| opt[key] = value end opt when Options then value else raise ArgumentError, "Unable to convert to Options: #{value.inspect}" end end |
Instance Method Details
#host_checker ⇒ Object
39 40 41 |
# File 'lib/guillotine/service.rb', line 39 def host_checker @host_checker ||= HostChecker.matching(required_host) end |
#strip_anchor? ⇒ Boolean
31 32 33 |
# File 'lib/guillotine/service.rb', line 31 def strip_anchor? strip_anchor != false end |
#strip_query? ⇒ Boolean
27 28 29 |
# File 'lib/guillotine/service.rb', line 27 def strip_query? strip_query != false end |
#with_charset? ⇒ Boolean
35 36 37 |
# File 'lib/guillotine/service.rb', line 35 def with_charset? !(length.nil? || charset.nil?) end |